note 93544 added to function.jdtounix

From: Date: Tue, 15 Sep 2009 16:41:49 +0000
Subject: note 93544 added to function.jdtounix
Groups: php.notes 
Request: Send a blank email to php-notes+get-160580@lists.php.net to get a copy of this message
Despite the comments above, it seems to me that both jdtounix() and time() are independent of the current time zone (at least on PHP 5.2.6-2ubuntu4.3). The time zone only comes into play when you try to *output* times. Hence the distinction between strftime() and gmstrftime(), for example. Try this: <?php print "<pre>"; date_default_timezone_set("America/New_York"); print( "default timezone = " . date_default_timezone_get() . "\n" ); print( "jdtounix = " . jdtounix($a) . "\n" ); print( "time() = " . time() . "\n" ); print( strftime( "%d/%m/%Y\n", jdtounix($a) ) ); print( gmstrftime( "%d/%m/%Y\n", jdtounix($a) ) ); date_default_timezone_set("Etc/UTC"); print( "default timezone = " . date_default_timezone_get() . "\n" ); print( "jdtounix = " . jdtounix($a) . "\n" ); print( "time() = " . time() . "\n" ); print( strftime( "%d/%m/%Y\n", jdtounix($a) ) ); print( gmstrftime( "%d/%m/%Y\n", jdtounix($a) ) ); print "</pre>"; ?> Result: default timezone = America/New_York jdtounix = 1252972800 time() = 1253032058 14/09/2009 15/09/2009 default timezone = Etc/UTC jdtounix = 1252972800 time() = 1253032058 15/09/2009 15/09/2009 ---- Server IP: 64.71.164.2 Probable Submitter: 128.18.248.116 ---- Manual Page -- http://www.php.net/manual/en/function.jdtounix.php Edit -- https://master.php.net/note/edit/93544 Del: integrated -- https://master.php.net/note/delete/93544/integrated Del: useless -- https://master.php.net/note/delete/93544/useless Del: bad code -- https://master.php.net/note/delete/93544/bad+code Del: spam -- https://master.php.net/note/delete/93544/spam Del: non-english -- https://master.php.net/note/delete/93544/non-english Del: in docs -- https://master.php.net/note/delete/93544/in+docs Del: other reasons-- https://master.php.net/note/delete/93544 Reject -- https://master.php.net/note/reject/93544 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160580) next »