You can use DateTime.Today with the exact seconds of 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
Aruna Nov 24 '16 at 7:32 2016-11-24 07:32
source share