Timezones

Chris H.

Member
I'm working on my first add-on, which includes a sports schedule component. Each game in the schedule has a date column of datatype int(10) unsigned, which stores the UTC date & time of the game as a unix time stamp. As best I can tell, this is exactly the format used by XenForo core, correct?

However, when I select these integer values and display them using the xen:date and xen:datetime functions in my templates, they are not converted to the user's timezone. What am I missing?

Example:
value of game_date (UTC integer) = 1315026000. This value is passed to the template.
In the template I have <xen:datetime time="{$game.date}" />, which results in a display to the user of Sep 3, 2011 at 12:00 AM.
However, the user & XF preferences are set to a time zone of U.S. Central, so that time should be adjusted accordingly.

It seems that the timestamp is being treated in the server's timezone, when in actuality it's UTC, just like XF stores post_date. What step in the process am I missing to make this display properly??
 
so nevermind, XF was doing the right thing. I was just trusting the data too much. Our "UTC" times were not really UTC.
 
Top Bottom