Template

Further reading: RFC 3339 / ISO 8601

top 50 comments

sorted by: hot top controversial new old
[–] 60 points 2 years ago* (3 children)

It should be implemented in people's brains.

How this goes, usually, is:

Them:...before 6PM.

Me: 6PM... Ours? The server's? The user's?

Them: GMT, of course.

Me: So that's 7PM London right now, and changes to 6PM in November?

Them: What no are you stupid. Always 6PM GMT.

Me:* jumps off a cliff*

  • source
  • hideshow 6 child comments
  • [–] 22 points 2 years ago (3 children)

    Them: GMT, of course.

    Me: So that’s 7PM London right now, and changes to 6PM in November?

    Them: What no are you stupid. Always 6PM GMT.

    Me:* jumps off a cliff*

    Sorry, but are you under the impression that GMT means London time, or that it observes British Summer Time?

  • source
  • parent
  • hideshow 4 child comments
  • [–] 14 points 2 years ago (1 child)

    UK is under BST (UTC+1) for half the year but people are usually just taught that the UK is GMT (UTC+0) which is based in the time in Greenwich, withought mentioning DST. I suppose it's also possible everyone is taught BST and just forgets about it because daylight savings sucks, but either way most people seem to think GMT and UK time are the same thing.

    This means you'll get people asking for GMT times when they want BST or UK local time.

  • source
  • parent
  • hideshow 2 child comments
  • load more comments (2 replies)
  • [–] 8 points 2 years ago (2 children)

    Don’t get it. Is this implying GMT has daylight savings?

  • source
  • parent
  • hideshow 3 child comments
  • [–] 9 points 2 years ago (4 children)

    GMT doesn't have daylight savings, but most people won't be as precise in language. Here in Germany, we might also tell people "GMT+2", even though it changes to GMT+1 in winter. Like, I don't even know what the correct shorthand would be for our timezone...

  • source
  • parent
  • hideshow 5 child comments
  • load more comments (3 replies)
  • load more comments (1 reply)
  • [–] 52 points 2 years ago (2 children)

    When the API returns UTC, but the system insists on giving you local time... but there's an extension method that accepts DateTimeOffset?

  • source
  • hideshow 4 child comments
  • [–] 12 points 2 years ago

    Or requires a timestamp with zone offset, but ignores the zone offset, so you have to send the timestamp itself with a zone offset of zero relative to the systems timezone, but can't just omit the zone offset, because it's required.

  • source
  • parent
  • [–] [S] 35 points 2 years ago (2 children)

    So just for additional context:

    This meme was brought to you by the following API response scheme:

    {
      "time": "2007-12-24 18:12",
      "servertimezone": "Europe/Vienna",
      "timezoneoffset": -8
    }
    

    when it could have just been

    {
      "date": "2007-12-24T18:21:00-07:00"
    }
    
  • source
  • hideshow 4 child comments
  • [–] 8 points 2 years ago (2 children)

    To be fair, returning the actual timezone (as defined by tz.db) is useful if you don't just want the current time since you'll be able to take DST into account. Not sure how Vienna is -8 though, it should be +1 (or 2 depending on DST).

  • source
  • parent
  • hideshow 4 child comments
  • [–] [S] 3 points 2 years ago* (last edited 2 years ago)

    Just for further clarification, the API works like this:

    • time is the local (client) time (in this case UTC-7)
    • servertimezone is the time zone where the server is located
    • timezoneoffset is the offset of the local time relative to the servertimezone (offset from the servers PoV)

    To get the UTC date you have to do something like this:

    time.minusHours(timezoneoffset).atZone(servertimezone).toUTC()
    
  • source
  • parent
  • [–] 29 points 2 years ago (5 children)

    Mandating UTC everywhere and eliminating the concept of time zones altogether is all a political candidate needs to do in order to earn my vote in 2024.

    Seriously, what is the point of time zones? The only explanation I’ve ever heard is “well if we didn’t have time zones, half the world would be expected to be awake when it’s dark out!” No. We could all just literally adjust the times of our business operations based around when daylight is usual for the different geographic regions as they have the sun shine on them. The physical “zones” of time zones could remain the same, and in those zones “noon” would just mean something other than “12:00.” “Noon” for one region could be 2300 while what is considered “noon” for another region could be 1800.

    (And for my next rant: why the 24 hour clock is superior to the 12 hour clock… reason number 1? There’s 24 hours in a day…)

  • source
  • hideshow 9 child comments
  • [–] 24 points 2 years ago (7 children)

    Implementing such a change has another problem: Who gets to have the time-zone that's noon at noon?

    Are we going to let the British continue to get away with it? Even the excuse of "that's the way it has to be to keep things simple" would cause the French to revolt. Again. They still don't like to talk about the fact that it's Greenwich and not Paris that's the prime meridian.

    Swatch's "Internet time" was a decimal system designed to mitigate the problem because no-one would have any idea what the old time was supposed to be, but people are used to the base-60 system. It didn't and won't catch on.

    And it doesn't fix the "0 isn't my midnight" problem, which is pretty close to the original.

    It also doesn't fix the "what time of day is it elsewhere in the world" problem, which still requires knowledge of time differences. You know. Time zones.

  • source
  • parent
  • hideshow 9 child comments
  • load more comments (5 replies)
  • [–] 18 points 2 years ago (1 child)

    So organising a meeting for 03:30 has the problem of that not being working hours for some people, and you have to look up what working hours are in each area. What problem is that supposed to solve?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 12 points 2 years ago (1 child)

    Instead of store hours like this:

    • Monday 6:00-18:00
    • Tuesday 6:00-18:00
    • Wednesday 8:00-18:00
    • Thursday 6:00-18:00
    • Friday 6:00-18:00

    We can have store hours like this:

    • Sunday 22:00-Monday 10:00
    • Monday 22:00-Tuesday 10:00
    • Wednesday 0:00-10:00
    • Wednesday 22:00-Thursday 10:00
    • Thursday 22:00- Friday 10:00

    Boy, I would love to live in a place where store hours would be like this. So convenient.

    And I’d love to have the change in the day be sometime in the middle of the day so that “see you tomorrow” means sometime later in the day. Or maybe different areas would use different conventions to refer to the time when the sun is out and most people are doing things and the time when most people are asleep.

    It would also be so pleasant and relaxing to visit a new country and constantly have to calculate the country’s time offset in my head. There would probably be an app on my phone that I would constantly look at that would convert the time where I am to the equivalent time I am used to. I won’t have a sense of when meals are or when I should expect stores to be open, or when it’s reasonable to wake up without converting to the time I’m used to. Some might say the thing I’m used to is my time “zone”.

    It would also be great for TV shows and books to always run into issues when talking about the time because there’s no universal reference.

    Even the actual convenience of scheduling a meeting with people in different parts of the world has issues. Now, you know that whatever time you say is the time for all people. But instead of being able to just look up each person’s time zone and see “oh, it would be 3am there, so they’d be asleep”, you’d have to go to some website that tells you what time most people sleep or what time most people eat meals, or whatever, and see by how many hours it differs.

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • load more comments (1 reply)
    [–] 28 points 2 years ago (1 child)
  • [–] 23 points 2 years ago (5 children)

    There is one big caveat to universal time:

    Future dates: If you use utc here and a time zone definition changes, you're boned. You have to store local time and offset for just this one usecase.

  • source
  • hideshow 8 child comments
  • [–] 5 points 2 years ago (1 child)

    Sorry, why would you be "boned" if you have UTC time? Are you thinking of the case where the desired behavior is to preserve the local time, rather than the absolute time?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 2 years ago (1 child)

    Not exactly boned but it probably doesn't make practical difference to store "local time + tzinfo timezone" than just UTC time.

    • You record an event occurring at local time
    • You store it as UTC
    • Local time zone definition changes
    • Well whoop de loo, now you need to go through tzinfo to make sense of the past data anyway rather than relying on a known offset

    Even if you store everything in UTC, you may be safe... but figuring out the local time is still convoluted and involves a trip through tzinfo.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 5 points 2 years ago*

    I think the comment is specifically talking about storing future times, and contemplating future changes to the local time zone offsets.

    If I say that something is going to happen at noon local time on July 1, 2030 in New York, we know that is, under current rules, going to happen at 16:00 UTC. But what if the US changes its daylight savings rules between now and 2030? The canonical time for that event is noon local time, and the offset between local time and UTC can only certainly be determined with past events, so future events defined by local will necessarily have some uncertainty when it comes to UTC.

  • source
  • parent
  • load more comments (2 replies)
    [–] 20 points 2 years ago (2 children)

    Anything an API returns should just look like 1720533944.963659 .

    There's no reason to store dates as anything other than UTC. User-side, sure, timezones are useful. Server doesn't have to know.

  • source
  • hideshow 3 child comments
  • [–] 17 points 2 years ago* (last edited 2 years ago)

    This is absolutely fundamentally wrong. What you've described is what Nodatime calls an Instant, and it's a very important data class, but there are valid reasons to use other classes.

    A LocalDateTime cares about the date and time locally. An event scheduled for 8am every Monday might use this. It would update accordingly if you move locations to a new locale.

    A ZonedDateTime can almost be directly translated into an Instant, except that one time zone might change. If you go into or out of daylight saving time, or your region decides to change its time offset. Oslo time is still Oslo time. You use this if your event occurs at a specific time in a specific location.

    An OffsetDateTime is like a ZonedDateTime, but instead of being tied to a specific time zone (e.g. "Oslo time") it's tied to a specific UTC offset (e.g. UTC+1).

    You don't have to use Nodatime, but you should at least think deeply about what your time objects actually represent and what is the best way to represent them.

    See the creator of Nodatime's presentation about thinking deeply about time for more.

  • source
  • parent
  • load more comments (1 reply)
    [–] 13 points 2 years ago (1 child)
  • [–] [B] 12 points 2 years ago

    There's an even worse thing: timezone selection UIs that don't let you choose UTC

  • source
  • [–] 6 points 2 years ago (2 children)

    Go:

    01/02 03:04:05PM '06 -0700

  • source
  • hideshow 4 child comments
  • [–] 6 points 2 years ago

    Then the desktop reads it and does it's own thing with it.

  • source
  • [–] 5 points 2 years ago

    Wait til you see what's required to parse HTTP-date fields.

    RFC 9110

  • source
  • load more comments
    view more: next ›