I know how to calculate the difference between two dates, but how do I calculate the time between a given date and the next 8 AM?
var now = DateTime.Now;
var tomorrow8am = now.AddDays(1).Date.AddHours(8);
double totalHours = ( tomorrow8am - now).TotalHours;
var now = DateTime.Now;
double diffHours = 24 - (now - now.Date).TotalHours + 8;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With