Datetime(HH:mm) not working

convert-to-date

#1

Hi, I am using doing the same as this link Get the hours difference in time. 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


#2

Try this.

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

image


#3

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


#5

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


#6

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