note 56558 deleted from function.date by derick

From: Date: Sun, 15 Jan 2006 12:42:10 +0000
Subject: note 56558 deleted from function.date by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-101826@lists.php.net to get a copy of this message
Note Submitter: Michiel vd Vis ---- 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

« previous php.notes (#101826) next »