Datetime(HH:mm) not working

Hi, I am using doing the same as this link Get the hours difference in time - #5 by arivu96. But the variable is in HH:mm format instead. It is not working

timeIn: 08:30
timeOut: 18:00
(DateTime.ParseExact(timeout, “HH:mm”, System.Globalization.CultureInfo.InvariantCulture)-DateTime.ParseExact(timein, “HH:mm”, System.Globalization.CultureInfo.InvariantCulture)).TotalHours.ToString()

Any Idea why it is not working?

Thank you xoxo

1 Like

Try this.

DateDiff(DateInterval.Hour,convert.ToDateTime(“18:30”),convert.ToDateTime(“08:30”)).ToString

image

Hi, the interval is suppose to be 9.5 but it is showing 9 for below time

1 Like

Hi @sangasangasanga, Yes… You are correct… It will return Hours without decimal. So can try minutes difference.

(DateDiff(DateInterval.Minute,convert.ToDateTime(“08:30”),convert.ToDateTime(“18:00”))/60).ToString

image

image

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.