note 56558 added to function.date

From: Date: Wed, 07 Sep 2005 11:20:31 +0000
Subject: note 56558 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-94856@lists.php.net to get a copy of this message
I created a function which calculates the days since the epoch: // @param date: Date formatted like "DD-MM-YYYY" // @return Days since epoch function daysSinceEpoch($date) { $date = explode("-", $date); $years = $date[2] - 1970; $tot_days = $years * 365; $tot_days += floor(($years + 1) / 4); // Add $tot_days += date("z", mktime(1,0,0,round($date[1]),round($date[0]),$date[2])); return $tot_days; } TODO: Error catching TODO: Support for dates < 1-1-1970 AND > 2031 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56558 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56558&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56558&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56558&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56558&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56558&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56558&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56558&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94856) next »