1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Timezones

Discussion in 'XenForo Development Discussions' started by Chris H., Aug 28, 2011.

  1. Chris H.

    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??
     
  2. Chris H.

    Chris H. Member

    so nevermind, XF was doing the right thing. I was just trusting the data too much. Our "UTC" times were not really UTC.
     

Share This Page