[Gambas-user] datediff to miliseconds

gen braga genbraga1 at gmail.com
Mon May 13 20:57:49 CEST 2019


Sure, i didnt notice the return type. My bad.

Maybe we could have an DateDiff function returning Long?

By the way,

   Dim dData1 As Date = CDate("05/13/2019 12:00")
   Dim dData2 As Date = CDate("05/13/2019 12:01")
   Print DateDiff(dData1, dData2, gb.Millisecond)

works fine.

-
Gen


Em seg, 13 de mai de 2019 15:10, Gianluigi <bagonergi at gmail.com> escreveu:
>
> 611085255000 I think it is normal that it gives error being superior to 2147483647 (max of integer).
> But I don't understand why this code returns 1200394968 instead of 611085255000:
>
>   Dim dData1 As Date = Now
>   Dim dData2 As Date = "01/01/2000"
>   Dim i As Integer
>
>   Print DateDiff(dData2, dData1, gb.Second)
>   Try DateDiff(dData2, dData1, gb.Millisecond)
>   If Error Then
>     Print DateDiff(dData2, dData1, gb.Second) * 1000
>   Else
>     DateDiff(dData2, dData1, gb.Millisecond)
>   Endif
>
> Regards
> Gianluigi
>
> Il giorno lun 13 mag 2019 alle ore 18:21 gen braga <genbraga1 at gmail.com> ha scritto:
>>
>> Hi there,
>>
>> in the below code:
>>
>>   Dim dData1 As Date = Now
>>   Dim dData2 As Date = "01/01/2000"
>>
>>   Print DateDiff(dData2, dData1, gb.Second)
>>   Print DateDiff(dData2, dData1, gb.Millisecond)
>>
>> is there anything wrong? I got an overflow when printing milliseconds
>>
>> -
>> Gen
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----


More information about the User mailing list