In my C# app, I pass a string variable that is of format yyyymmdd-yyyymmdd that represents a from and to date. I want to get the start and end times for these dates respecti
I am surprised to see how an incorrect answer received so many upvotes:
The correct version would be as follows:
public static DateTime StartOfDay(this DateTime theDate) { return theDate.Date; } public static DateTime EndOfDay(this DateTime theDate) { return theDate.Date.AddDays(1).AddTicks(-1); }