note 85110 added to function.date

From: Date: Thu, 14 Aug 2008 22:53:39 +0000
Subject: note 85110 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-143509@lists.php.net to get a copy of this message
All novices must be very carefull when working with timestamps as second values. From first glance it looks like date("Y-m-d H:i:s",TIMESTAMP) will return correct date, based on "how much seconds gone from 1970". But here is the feature, it'll be corrected time, according to LOCAL timezone. So if you take a 25200 as timestamp (10 hours), then on one server you'll get 1970-01-01 08:00:00 and on other server you'll get 1970-01-01 09:00:00 and so on. Though you could expect 1970-01-01 10:00:00 in all cases, because if 25200 seconds gone from 1970-01-01 00:00:00 it obviously have to be 1970-01-01 10:00:00 I spend today 3 hours to correct scripts which were created with such error by previous programmer, so please, guys, don't make me work like this and remember about conversation to LOCAL time. ---- Server IP: 195.54.192.44 Probable Submitter: 127.0.0.1 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/85110 Del: integrated -- https://master.php.net/note/delete/85110/integrated Del: useless -- https://master.php.net/note/delete/85110/useless Del: bad code -- https://master.php.net/note/delete/85110/bad+code Del: spam -- https://master.php.net/note/delete/85110/spam Del: non-english -- https://master.php.net/note/delete/85110/non-english Del: in docs -- https://master.php.net/note/delete/85110/in+docs Del: other reasons-- https://master.php.net/note/delete/85110 Reject -- https://master.php.net/note/reject/85110 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#143509) next »