Search code examples
phpjavascriptzend-frameworktimezonezend-date

How can I simply change the Timezone Offset with Zend_Date?


I'm using Zend_Date to manage dates/times in a scheduling app.

The only way I'm able to determine the user's Timezone is via Javascript which only gives a Timezone Offset. Zend_Date only seems to take Timezones in the 'America/New_York' format.

Is there a way to get the users timezone in this format or set the Timezone Offset with Zend_Date?

Thanks!


Solution

  • Nicky,

    You don't really need Zend_Date for this as the PHP intrinsic DateTime and DateTimeZone objects work well for this; however, I can point you in the right direction if you really need to use Zend_Date.

    See the following examples

    1. $date = new Zend_Date(1234567890, false, $locale);
    2. $date->toString... (see: http://framework.zend.com/manual/en/zend.date.constants.html for more details)
    3. Use the following Constants for ISO 8601: (Z = Difference of time zone [+0100])

    This should get you to where you need to be. Please post code samples if you get stuck.