date - php showing wrong time after daylight savings -
i have php programme lets employees clock in/out every day. since daylight savings, it's showing users clocking in , out hr later did. here's example:
<?php echo 'now: '. date('h:i:s a') ."\n"; echo "timestamp: " . date('u') . "\n"; ?>
it's 11:45. it's showing 12:45 result. ideas why happening?
edit
the code above not part of timeclock. it's illustration i'm using show it's giving wrong results. timezone has no bearing on result. if utilize gmt, still shows hr ahead of should be. , worked yesterday, so...
set default timezone php recognizes. here ny:
date_default_timezone_set('america/new_york');
dst/std time handled automatically.
php date dst
No comments:
Post a Comment