Forum Moderators: coopster

Message Too Old, No Replies

Number of days since 1/1/2000

My solution does not handle DST

         

veggie lover

10:52 pm on Mar 10, 2008 (gmt 0)

10+ Year Member



I am using the following code which gives an incorrect answer at midnight to 1 AM due to the time moving ahead one hour from daylight savings time:

function get_current_day() {

$then = mktime ( 0 , 0, 0, 1,1,'00');
$now = time();

$days = ($now - $then ) / 86400 - 1;

return (int) $days;

} // end function

phranque

11:44 pm on Mar 10, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



perhaps date_offset_get [php.net] would be useful...