Working with Time is Easy Jon Skeet

NDC Conferences · 24K views · 2017 · 1:04:43

Open on YouTube

Software practice, open source & careersSoftware architecture & designtalk

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about time zones, UTC storage and date handling, as a clear conceptual grounding that applies beyond any one language.

Recommended by 2 people across 2 different months, 2017 to 2021.

What it is

A conference talk by Jon Skeet at NDC London on why date and time code is so often broken and how to get it right. It presents a minimal set of concepts, common gotchas around time zones and calendar systems, and strategies for testing time-dependent code.

What people said

Recommends DeveloperExceptionError · 2017-10 · Stack Overflow · on “How to take care of different timezones in RemoteApp”

To answer your question: If you use DateTime.Now the generated timestamp will be in the local timezone of the machine the code runs on. If you are sharing the timestamp with the server and use it for more than just displaying a local time, do not use DateTime.Now . It will cause you a lot of trouble later on. If you want to use the build-in .NET Framework types, I recommend using DateTime.UtcNow to generate the timestamp. Whenever you want to display it, you can call DateTime.ToLocalTime() on the client system to get a local representation of the timestamp. I would recommend using NodaTime [LINK] to handle time related data, as it enforces a better handling of date and time data due to its s

Recommends stackchain · 2019-09 · Stack Overflow · on “Mysql Timezone with React.js/Node.js”

Storing time & date data relies on what you need to do with it in terms of retrieval, manipulation, and display. Does it represent the past (i.e log) or the future (i.e appointment)? The past is easy it happened and you likely know when and where. But the future, the DST could affect it. In your case, it looks like a display problem, then you can choose who will pay the CPU bill, your company or the user. So you can use CONVERT_TZ() to retrieve it and save in UTC'0. I would recommend you to create a VIEW with this rule. (perhaps new teammates dunno about this conversion). In this case, the processing cost is yours. On the other hand, you can transfer it to the user, and adjust the UTC'0 -> I

Cites Sweeper · 2020-05 · Stack Overflow · on “Date Format with different Timezone in Java”

I don't know anything that's specific to Java, but the video that made me click was this one [this video] . It uses NodaTime (a C# date and time library) terminology, but it shouldn't matter too much...

Cites Luiz · 2021-08 · Stack Overflow · on “Best practices for handling timezone on API filters”

We save all our datetime data on database in UTC (a timestamp with time zone column in postgresql). Assuming "America/Sao_Paulo" timezone, if a user saves an event "A" to the database at 2021-08-24 22:00:00 (local time) this will be converted to UTC and saved as 2021-08-25 01:00:00 . So, we are wondering what would be the best way (here "the best way" refers to the developer experience) to consume an API where is possible to filter events by start and end date. Imagine the following situation: the user is on the website and needs to generate a report with all events that happened on 2021-08-24 (local time America/Sao_Paulo). For this, the user fills start and end date both with 2021-08-24 .