Time format

Hi,

I have code to do calculating the time,

[code] Dim BeginDate as new Date
BeginDate.SQLDatetime= “2020-02-12 17:30:00”

Dim EndDate as new Date
EndDate.SQLDatetime=“2020-02-13 02:00:00”

Dim DateDifference as Double
DateDifference = EndDate.TotalSeconds - BeginDate.TotalSeconds

Dim DiffDate as new Date
DiffDate.TotalSeconds = DateDifference

dim gg,dd as integer
gg=DiffDate.TotalSeconds/3600

MsgBox DiffDate.sqldatetime.NthField(" ",2)[/code]

The result is correct (08:30:00)

how to convert it into integer, i am expecting the result is 8.5 hours.

any help ?

thanks
regards,
Arief

8 would be an integer, 8.5 would be a double, change gg to a Double and you should have the answer you’re looking for.

Dim gg As Double gg = DiffDate.TotalSeconds / 3600 msgbox str(gg)

thanks

Regards,
Arief