I need to create a midnight DateTime
I\'ve just done this:
DateTime endTime = DateTime.Now;
endTime.Subtract(endTime.TimeOfDay);
Ha
You can use DateTime.Today with exact seconds of the midnight.
DateTime today = DateTime.Today;
DateTime mid = today.AddDays(1).AddSeconds(-1);
Console.WriteLine(string.Format("Today: {0} , Mid Night: {1}", today.ToString(), mid.ToString()));
Console.ReadLine();
This should print :
Today: 11/24/2016 10:00:00 AM , Mid Night: 11/24/2016 11:59:59 PM