note 68156 added to function.strtotime

From: Date: Sat, 15 Jul 2006 17:09:07 +0000
Subject: note 68156 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-114808@lists.php.net to get a copy of this message
Be careful if you use combined JavaScript and PHP with strtotime you have to keep in mind, that you may get different timestamps. The following code will generate the same timestaps: <?php echo strtotime("2006-07-31 02:00:00"); ?> <script type="text/javascript"> document.writeln(Date.UTC(2006, 06, 31, 0, 0, 0)); </script> First you have to notice, that the Javascript Date.UTC function starts months counting with 0, not with 1 (for january) - this is documented well. But what I did not know and took me some time to find out is that you need to modify the time in strtotime() (for me it's 2 hours more than the JavaScript time). This maybe has something to do with GMT on local server, but I have no idea, so if you should know the reason why, please let me know. Bernhard ---- Server IP: 217.13.201.10 Probable Submitter: 84.56.247.219 ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- http://master.php.net/note/edit/68156 Del: integrated -- http://master.php.net/note/delete/68156/integrated Del: useless -- http://master.php.net/note/delete/68156/useless Del: bad code -- http://master.php.net/note/delete/68156/bad+code Del: spam -- http://master.php.net/note/delete/68156/spam Del: non-english -- http://master.php.net/note/delete/68156/non-english Del: in docs -- http://master.php.net/note/delete/68156/in+docs Del: other reasons-- http://master.php.net/note/delete/68156 Reject -- http://master.php.net/note/reject/68156 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#114808) next »