DateTimeOffset Simple initialising and usage with different TimeZones
Many many articles online talking about when, why and how to use DateTimeOffset.
On the top list:
- Choosing Between DateTime, DateTimeOffset, TimeSpan, and TimeZoneInfo
- DateTime vs DateTimeOffset
- DateTimeOffset Structure
I have used it myself in many projects, last one is a website used by different distributors in many different countries with thousands of customers under each distributor, and I found DateTimeOffset is the solution for managing datetime between different time zones.
You can find many examples online on how to use it in details, but the one I wanted to list here as a reminder for my self is how to initialise it with a certain time zone offset and read from the DateTimeOffset the current date time based on this time zone.