# IntlCalendar/IntlTimeZone and ext/date

- Thread: https://externals.io/message/60605
- Original archive: https://news-web.php.net/php.internals/60605
- Started by Gustavo Lopes on 2012-05-17T21:34:37+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #60605 — Gustavo Lopes — 2012-05-17T21:34:37+00:00

URL: https://externals.io/message/60605#60605

I've made some modifications to ext/intl's IntlCalendar/IntlTimeZone to  
improve interoperability.

* DateTimeZone is now accepted in all places time zones are expected in  
IntlCalendar.
* Added IntlTimeZone::toDateTimeZone() and  
IntlTimeZone::fromDateTimeZone().
* Added IntlCalendar::toDateTime() and IntlCalendar::fromDateTime().

Unfortunately, ext/date doesn't expose a lot of interfaces to manipulate  
its objects, so in some places I ended up having to call PHP_FUNCTIONs (in  
one case even twice doing to a bug; see  
https://github.com/cataphract/php-src/commit/3a81f90ebc51140484c617539b1a5fb0e117f4e2#L1R1264  
).

The conversion from DateTimeZone to IntlTimeZone is made through the ids  
only because ext/date doesn't expose interfaces to efficiently implement  
ICU's TimeZone. This may lead to some different behavior for the same time  
zone id if the databases are out of sync.

The changes are here:  
https://github.com/cataphract/php-src/compare/intl_calendar

If no one objects, I'll merge it soon.

-- 
Gustavo Lopes
