There is no date processing for BCL , I read the NodaTime documentation and did not find anything there.
Not knowing how your code works right now, I would recommend that you move on to any of the following ideas; either create an extension method to get the “correct” date (in your model) or create a new date class for your purposes.
Extension Method:
public static class DateTimeExtension { public static DateTime GetDay(this DateTime date) { return date.TimeOfDay > TimeSpan.FromHours(3) ? date.Date : date.AddDays(-1).Date; } }
Or create your own type MyDateTime , which works the way you want. I don’t know what you need, but it takes a lot of work to get all the “normal” DateTime methods.
source share