05-29-2008, 03:06 PM
|
#17 (permalink)
|
|
The Frequenter
Join Date: Oct 2007
Location: Manchester, UK
Posts: 469
Thanks: 26
|
with the date_default_timezone_set('Asia/Tokyo')
set it outputs:
1.04166666667
but if you also change
PHP Code:
DateTimeZone('Europe/London')
to
PHP Code:
DateTimeZone('Asia/Tokyo')
it calculates the correct offset for Asia/Tokyo instead of Europe/London and thus out puts 1 day correctly.
this should do it automatically:
PHP Code:
date_default_timezone_set('Asia/Tokyo'); $date = '05-03-2008'; $date2 = '10-03-2008'; $dstZone = new DateTimeZone(date_default_timezone_get()); echo 'Difference: ',((strtotime($date2) + $dstZone->getOffset(new DateTime($date2))) - (strtotime($date) + $dstZone->getOffset(new DateTime($date)))) / 86400, ' Days';
__________________
Last edited by sketchMedia : 05-29-2008 at 03:18 PM.
Reason: pasted incorrect code
|
|
|
|