|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-11-07 21:12 UTC] luttkens at gmail dot com
Description:
------------
getTimestamp() is supposed to return the time in UNIX-timestamp. To my
understanding a unix timestamp is always in UTC and not affected by the timezone.
That is; regardless the the timezone, getTimestamp() should return the same value
for any date. In most cases it does, but not on daylight-saving-time (DST)
transitions.
I have create a short script that illustrates the problem.
Test script:
---------------
$date1 = new DateTime("@1351382400"); // Sun Oct 28 2012 02:00:00 GMT+2 (DST)
var_dump($date1->getTimestamp()); //prints: 1351382400
$date1->setTimezone(new DateTimeZone("Europe/Stockholm"););
var_dump($date1->getTimestamp()); //prints: 1351386000
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 11:00:02 2025 UTC |
Somethings is different between format('U') and getTimeStamp(). The format('U') returns the correct timestamp whereas getTimestamp returns a wrong one. See https://3v4l.org/cVRBI