|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-08-20 09:14 UTC] asphp at dsgml dot com
Description: ------------ --- From manual page: http://www.php.net/function.jdtounix --- It says: "The time returned is localtime (and not GMT)." But this is not true. Part of the problem is bug #13187 which claims: "so jdtounix returns localtime while mysql unix_timestamp returns GMT" Which is not true! It's actually exactly the opposite! MySQL returns localtime, and PHP returns GMT. You can even look at the source code: (uday * 24 * 3600) No adjustment whatsoever for timezone. Test script: --------------- <? date_default_timezone_set('America/New_York'); echo jdtounix(2440588) , "\n" . jdtounix(2440589); Expected result: ---------------- If it was local time then I would not get: 0 86400 But I do. Those times are exactly midnight UTC. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Jan 29 16:00:01 2026 UTC |
And just to really confuse everyone, unixtojd() IS localtime, but doesn't say so in the documentation! Source code: if (!(ta = php_localtime_r(&ts, &tmbuf))) {