10

Just curious as to what the reasoning behind making the time stamps for the questions and answers in UTC instead of localizing the time for the client.

I do realize it's easier to store the value in UTC. But, I would guess most of us think in local time and showing the date and time of the post isn't as meaningful if it's in UTC, having to do a conversion each time we see it.

I think it would be more useful and intuitive if it showed "answered Jul 2 at 15:38 EST" where EST is the viewer's local time zone.

It's possible I'm just not Skeet enough to think in Coordinated Universal Time. (Skeet is an adjective as well as a verb, right?)


EDIT: As noted by me and others, perhaps defaulting to UTC, but allowing a user to select a different timezone in their profile would be a reasonable request.

5
  • Did not find possible duplicates when viewing the suggested list when typing the question. While this is more of a "why" question... there is a localization request here: meta.stackexchange.com/questions/1359/… To continue the "meta" theme... is it most appropriate to click "delete" now that I've found this?
    – Feckmore
    Commented Jul 6, 2009 at 21:15
  • Since this question can really only be answered by the dev team, and since there's already a feature request for local times, then I would recommend deleting this post and continuing the discussion there. Commented Jul 6, 2009 at 21:20
  • @Kyle: Is it worth me porting my answer over there, do you think?
    – Jon Skeet
    Commented Jul 6, 2009 at 21:25
  • @Kyle: does your advice still stand after an answer is given. I'm still learning the culture of SO and MSO.
    – Feckmore
    Commented Jul 6, 2009 at 21:38
  • @Traples: I'm still getting the hang of Meta myself. I'm not going to force this closed or anything, but if you want, I can merge the answers here into that feature request. It would destroy this question, so I leave it up to you. Commented Jul 6, 2009 at 23:12

2 Answers 2

4

I agree with Traples, w/ exceptions for feasibility:

  • Store in database in UTC
  • compute all statistics (daily point totals, limits, etc.) in UTC
  • convert times for display as date/time to local time
    • local timezone defaults to UTC
    • local timezone can be set by user on user's account page
6

Do you really want users to bother filling in their time zone? JavaScript can guess what offset you happen to be at right now, but that's not a good indication for any other point in time. Then you'll get users who have seen the right information until recently, but things have gone wrong for them because it had autodetected their settings and got the wrong actual location, etc. (1)

Then you have to make sure the server always has up-to-date time zone information, which isn't as easy as it might sound (depending on exactly what you're doing).

It's definitely feasible - especially if it's just a case of representing a UTC instant as a local time - but I'd personally rather see everything in UTC completely, rather than have the "7 mins ago" stuff.

(It wouldn't have been nearly as easy pre-.NET 3.5, by the way.)

As someone who has to deal with time zones all the time, I'd advise Jeff and the team to stay away from them unless they really, really have to handle them. (It's possible that StackExchange will have to do this, as there'll be more local deployments I suspect.)


(1) At least we could get away with a single time zone setting on SO. When trying to provide support to ActiveSync users on iPhones, I have to ask users for four different time zone settings - two on Google Calendar and two on the iPhone. Madness.

5
  • 1
    1) user's filling in the time zone could be optional... if they choose to, they would see their local time zone, if not they see UTC. 2) I thought I was kidding with the "not Skeet enough" remark. I'm amazed that even you would prefer to read a UTC time to "17 minutes ago." I'm guessing you might be in the minority here. That's just a guess.
    – Feckmore
    Commented Jul 6, 2009 at 21:35
  • 2
    Not to be picky, but it's a lot easier for someone living in the UK to say "I'd personally rather see everything in UTC completely, rather than have the "7 mins ago" stuff" than someone living in, let's say, New Zealand. As for "you'll get users who have seen the right information until recently, but things have gone wrong for them because it had autodetected their settings and got the wrong actual location, etc.": they should just default the user's timezone preference to UTC, then no one will notice any change unless they set that preference.
    – Kip
    Commented Jul 6, 2009 at 21:46
  • True... although New Zealand might not be the best example, as that's relatively easy to get right: 6am => 6pm etc :)
    – Jon Skeet
    Commented Jul 6, 2009 at 21:57
  • @Traples: If it gives a UTC date/time, then I don't have to guess how much difference there really was between two answers both marked "6 hours ago".
    – Jon Skeet
    Commented Jul 6, 2009 at 21:57
  • 3
    "As someone who has to deal with time zones all the time, I'd advise Jeff and the team to stay away from them" -- That's good enough for me! Commented Jul 7, 2009 at 8:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .