I am trying to parse an object of the class TimeOnly
to DateTime
(And of course there is no date in TimeOnly
object, I just need a DateTime
object which has the same time.)
We can convert DateOnly
Objects to DateTime
by using:
var dateTime = dateOnly.ToDateTime(TimeOnly.MinValue);
But similar process is not available while trying to convert from TimeOnly
to DateTime
. How do I achieve this in clean and efficient manner?
I have browsed this thread which addresses a question to store Only Time in an object. The thread is 12 years (Before .Net6; era of "TimeOnly" class) old and the answers suggest to implement a custom class to achieve the conversion (Which is an overkill in my case)