note 52161 added to function.strtotime

From: Date: Fri, 22 Apr 2005 16:59:36 +0000
Subject: note 52161 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-88410@lists.php.net to get a copy of this message
If you strtotime the epoch (Jan 1 1970 00:00:00) you will usually get a value, rather than the expected 0. So for example, if you were to try to use the epoch to calculate the difference in times (strtotime(Jan 1 1970 21:00:00)-strtotime(Jan 1 1970 20:00:00) for example) You get a value that depends strongly upon your timezone. If you are in EST for example, the epoch is actually shifted -5 to YOUR epoch is Jan 1 1970 19:00:00) In order to get the offset, simply use the following call to report the number of seconds you are away from the unix epoch. $offset=strtotime("1970-01-01 00:00:00"); Additionally, you can append GMT at the end of your strtotime calls so save yourself the trouble of converting relative to timezone. ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52161 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52161&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52161&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52161&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52161&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52161&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52161&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88410) next »