Friday, April 27, 2012

Timezone offset in seconds php vs ruby

echo date('Z');

10800

and timizone seems to be set right


date_default_timezone_set('Europe/Bucharest');echo date('Z');
10800



and in ruby it gives


Time.zone.now.utc_offset()
 => -25200


seems that rails and php lives in different timzones

so try to use localtimezone and is correct now


l = t.getlocal
 => 2011-06-27 10:10:00 +0300
1.9.2p318 :025 > l.gmt_offset
 => 10800




No comments: