note 93544 deleted from function.jdtounix by danbrown

From: Date: Tue, 15 Sep 2009 17:26:39 +0000
Subject: note 93544 deleted from function.jdtounix by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160581@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- 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

« previous php.notes (#160581) next »