Hi,
I need an int which has value of how many seconds will exist until midnight.
I am using
time = System.DateTime.Compare(System.DateTime.Now, //today midnight dont know how to write);
Then I want var time convert to int seconds
Thanks
Hi,
I need an int which has value of how many seconds will exist until midnight.
I am using
time = System.DateTime.Compare(System.DateTime.Now, //today midnight dont know how to write);
Then I want var time convert to int seconds
Thanks
DateTime current = DateTime.Now; // current time
DateTime tomorrow = current.AddDays(1).Date; // this is the “next” midnight
double secondsUntilMidnight = (tomorrow - current ).TotalSeconds; // get the difference between the DateTimes and get seconds
This should do the trick. Convert it to int if you want.