Hi! I have been a .NET developer since 2016, mostly on the backend. Most of my work is about data: moving it, storing it and reading it back. And then a date shows up.
The bug
We had a UI used by people from different time zones. One of its main features was filtering the data by date. The app had a DateTimeOffset, but the column in SQL Server was datetime2. SQL Server copies the date and the time and cuts the offset off, so 01:30+02:00 became just 01:30. Work for most of the time, to be fair. For simple CreatedAt columns
And on the day the clocks changed, everything blew up.
Take two users, one in Berlin and one in Tokyo, and the same filter: 25 October 2026. In Tokyo the day starts at 2026-10-24T15:00Z and lasts 24 hours. In Berlin the clocks go back that night from 03:00 to 02:00, so the day starts at 2026-10-24T22:00Z and lasts 25 hours. Two different ranges, and both of them are correct. A filter that counts every day as 24 hours cuts the last hour of the Berlin day.
Why DateTimeOffset is not enough
DateTimeOffset keeps the point in time, so two servers always agree. But it keeps an offset, not a zone. +02:00 is also Johannesburg, where nothing changes in October. So midnight +02:00 plus one day is 24 hours, and the day ends at 23:00 in Berlin.
You need the zone. NodaTime has it, and if you already use it, stay with it. I wanted something smaller: the BCL types, with the zone attached. So I wrote DateTimeZone, a struct with a DateTimeOffset and a TimeZoneInfo.
The filter
1 2 | dotnet add package SolTechnology.DateTimeZone |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | using SolTechnology.Time; var day = new DateOnly(2026, 10, 25); var midnight = new TimeOnly(0, 0); var tokyo = Zones.Resolve("Asia/Tokyo"); var from = new DateTimeZone(day, midnight, Zone.EuropeBerlin); var to = from.AddDays(1); var berlinDay = to - from; // 1.01:00:00, 25 hours var tokyoFrom = new DateTimeZone(day, midnight, tokyo); var tokyoTo = tokyoFrom.AddDays(1); var tokyoDay = tokyoTo - tokyoFrom; // 1.00:00:00, 24 hours var fromUtc = from.UtcDateTime; // 2026-10-24T22:00:00Z var toUtc = to.UtcDateTime; // 2026-10-25T23:00:00Z |
CreatedAt >= fromUtc AND CreatedAt < toUtc. The same code for both users, without a single if. The user’s zone comes with the request, as text. The browser gives it with Intl.DateTimeFormat().resolvedOptions().timeZone.As text the value is 2026-10-25T00:00:00+02:00[Europe/Berlin]. This format is RFC 9557, Java’s ZonedDateTime writes the same, so the zone survives JSON too.
Limits
It is young, 2.0 is from October 2026. And zones come from the operating system: chiseled and distroless .NET images, and Alpine without tzdata, have no zones at all.
Summary
Our bug was not the filter. It was the database column that kept the date and the time and dropped the rest. Whatever type you pick, keep the zone next to the moment.
Recommendation for ASP.NET 11.0 Hosting
A solid base for developing online services and applications is ASP.NET Core 11. Before creating an ASP.NET web application, you must be proficient in JavaScript, HTML, CSS, and C#. There are thousands of web hosting providers offering ASP.NET hosting on the market. However, there are relatively few web hosting providers that offer top-notch ASP.NET hosting.
ASP.NET is the best development language in Windows platform, which is released by Microsoft and widely used to build all types of dynamic Web sites and XML Web services. With this article, we’re going to help you to find the best ASP.NET Hosting solution in Europe based on reliability, features, price, performance and technical support. After we reviewed about 30+ ASP.NET hosting providers in Europe, our Best ASP.NET Hosting Award in Europe goes to HostForLIFE.eu, one of the fastest growing private companies and one of the most reliable hosting providers in Europe.
