Issue Type: Improvement Created: 2008-08-15T16:53:55.000+0000 Last Updated: 2008-08-18T11:35:14.000+0000 Status: Resolved Fix version(s): - 1.6.1 (15/Sep/08)
Reporter: Tianon Gravi (admwiggin) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date
Related issues: Attachments:
I realize that this would invalidate the $_timezone member, but it would be nice if one could manually modify the $_offset parameter using some getters and setters. In contrast, it would also be nice to be able to give setTimeZone something other than the PHP timezones (more along the lines of "-7" or "GMT+0600"). My reasoning for wanting to set the $_offset member myself are that I can get a unix timestamp for the server, and a unix timestamp for the client, so I can get the value of $_offset, but I can't easily get a value that setTimeZone likes.
Posted by Thomas Weidner (thomas) on 2008-08-16T01:50:11.000+0000
No, there will be no setter/getter for this private property, because there are dependencies on other members.
Offset is used for holding the offset for the servers time to the real time when using Zend_TimeSync.
When creating a date object you can simply set Timezones by setting a real timezone along the olson database, or a windows timezone using Zend_Locale or simply an hour offset like +0600 or -02:00 by using the proper input formats.
Anyhow you calculate this, you must give an hour offset. All other things will not be recognised as Timezone setting as timezones are ALWAYS hour offsets.
There is also a getTimezoneByString method which could be handy.
Posted by Thomas Weidner (thomas) on 2008-08-16T01:51:21.000+0000
Feature would corrupt other features necessary for date calculation.
Posted by Tianon Gravi (admwiggin) on 2008-08-18T08:30:37.000+0000
I couldn't convince setTimezone to accept any kind of hour offset (even in formats like 'UTC+0800' or 'UTC-7'), so my solution ended up being looping over the list returned by timezone_abbreviations_list() and just using the first timezone_id that had the offset I was looking for. This isn't the best solution, but it's the best I could come up with to just allow me to adjust my Zend_Date objects into the offset I want/need.
Posted by Tianon Gravi (admwiggin) on 2008-08-18T10:37:27.000+0000
Long story short, timezone_abbreviations_list() doesn't really work too well. Too many duplicates with different offsets.
timezone_name_from_abbr, however, works like a charm:
Have you found an issue?
See the Overview section for more details.