Blog Posts with Tag TimeOnly

New DateOnly and TimeOnly Types in .NET 6

I keep finding new little gems in .NET 6. The latest was the DateOnly and TimeOnly structs in .NET 6. Previous to .NET 6, time was typically represented as a DateTime, a DateTimeOffset, or sometimes a TimeSpan for intervals. DateTime and DateTimeOffset worked, but there are odd situations where you need to represent just a Time or just a Date. Trying to represent a Time in a DateTime can lead to all kinds of odd situations. Is one DateTime UTC vs Local, etc? What if I just…

December 28, 2021
approximately 2 minutes to read
© 2024 - Built and designed by Jeremy Honl with Gatsby. Images are from Unsplash