I have this code in vb:
dim d As Object
d = CDec((DateDiff("n", Format(StartTime), "hh:mm tt"), Format(EndTime), "hh:mm tt")) + 1) / 60)
Here, StartTime
and EndTime
is Date
, and value is 09:30 AM and 06:30 PM. This gives me value 9.01666666666667
When i Converted this in C#:
object d;
d = decimal.Parse(((DateAndTime.DateDiff("n", StartTime.ToString("hh:mm tt"), EndTime.ToString("hh:mm tt")) + 1) / 60).ToString());
Here, StartTime
and EndTime
is DateTime
and value is 09:30 and 18:30. This gives me value 9.
I do not get a decimal value. Is there anything i am missing? Is it because the EndTime
is in 24hrs DateTime
format?