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

 ID:                 52577
 User updated by:    vadimx at gmail dot com
 Reported by:        vadimx at gmail dot com
 Summary:            Incorrect date returning
 Status:             Assigned
 Type:               Bug
 Package:            Date/time related
 Operating System:   Windows
 PHP Version:        5.3.3
 Assigned To:        derick
 Block user comment: N

 New Comment:

When i use date_default_timezone_set('UTC'), all ok. But in doc "Note:
The 

$timezone parameter and the current timezone are ignored when the $time
parameter 

either is a UNIX timestamp (e.g. @946684800) or specifies a timezone
(e.g. 2010-

01-28T15:00:00+02:00).". why timezone affect to unixtime?


Previous Comments:
------------------------------------------------------------------------
[2010-08-11 01:08:08] fel...@php.net

For example, using date_default_timezone_set('UTC'); I cannot reproduce
it.

But using your timezone I got same result.

------------------------------------------------------------------------
[2010-08-11 00:57:51] vadimx at gmail dot com

date_default_timezone_set('Europe/Kiev');

But, i try change timezone, but this no effect.

------------------------------------------------------------------------
[2010-08-11 00:44:17] fel...@php.net

What timezone are you using?

------------------------------------------------------------------------
[2010-08-10 18:23:41] vadimx at gmail dot com

Description:
------------
When i use unixtime in DateTime object, this returning wrong date, -1
day.

Test script:
---------------
$date = '7.8.2010';

echo "String: ".$date."<br>";

$date_format = 'j.m.Y';

$unixtime = strtotime($date);

echo "Unixtime: ".$unixtime."<br>";

echo "Date(PHP): ".date($date_format,$unixtime)."<br>";

$date = new DateTime('@'.$unixtime);

echo "DateTime(PHP Class): ".$date->format($date_format);

Expected result:
----------------
String: 7.8.2010

Unixtime: 1281128400

Date(PHP): 7.08.2010

DateTime(PHP Class): 7.08.2010

Actual result:
--------------
String: 7.8.2010

Unixtime: 1281128400

Date(PHP): 7.08.2010

DateTime(PHP Class): 6.08.2010


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



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

Reply via email to