TimeOnly
was one of the new types introduced with .Net 6 along with DateOnly
. I understand the great need for the DateOnly
type as there are many instances you would want to store a date without a related time but no data type that did so.
However, in regards to time, TimeSpan
already exists and is capable of representing times. Timespan
very similar to TimeOnly
except, TimeOnly
seems to have a few properties missed.
Is there any great benefit offered from using TimeOnly
instead of TimeSpan
apart from saving a bit a memory?
TimeOnly
vsTimeSpan
not just how to represent Time. – DelwinTimeSpan
has a range of approx +/- 29,000 years and thatTimeOnly
can only represent times on a 24hr clock. – Delwin