Edit report at http://bugs.php.net/bug.php?id=52870&edit=1

 ID:                 52870
 Updated by:         der...@php.net
 Reported by:        great at km13 dot ru
 Summary:            DateTime ignoring timezone when outputting unix
                     timestamp
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Date/time related
 Operating System:   all
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Unix timestamps are a moment in time and so timezones have no influences
on them. They count the number of seconds since 1970-01-01 00:00 *UTC*

See: http://en.wikipedia.org/wiki/Unix_time


Previous Comments:
------------------------------------------------------------------------
[2010-09-17 15:03:38] great at km13 dot ru

Description:
------------
If I create a new DateTime object with different timezone and then try
to get Unixtimestamp ('U'), I always get timestamp of my current
timezone.

Test script:
---------------
// UTC+5

$date = new DateTime( 'now', new DateTimezone( 'Asia/Yekaterinburg' )
);

echo $date->format( 'U' ) . "\n";



// UTC+3

$date = new DateTime( 'now', new DateTimezone( 'Europe/Moscow' ) );

echo $date->format( 'U' );



Expected result:
----------------
1284734980

1284727780

Actual result:
--------------
1284727780

1284727780


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52870&edit=1

Reply via email to