Open jeffchan opened 10 years ago
I'm working on a fix for this
Thanks for reporting this. Glad to hear you're working on it.
@jeffchan did you get anywhere on your fix?
This is actually related to the following Notice from the PHP Manual
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
).
We ignore the specified timezone, but still keep it around if you ask for it. If you print it out with format(), you'll see behavior that matches the PHP manual.
This isn't intentional, just saying we're not quite as broken as it seems :p
I looked into this and it is much harder than I expected. Our timezone handling is wildly different than php5s.
Any progress on this? The following is also broken:
$date = new DateTime('1994-11-15T06:12:31-0200');
echo $date->format(DateTime::ISO8601), "\n"; // this is OK
echo $date->getTimezone()->getName(), "\n"; // not OK
echo $date->getTimezone()->getOffset(new DateTime('now')), "\n"; // not OK
The timezone parameter of the
DateTime
constructor should only be used as a hint. Currently in HHVM it is stored as the actual timezone.Zend:
string(6) "+00:00"
HHVM:
string(21) "Antarctica/South_Pole"