[Gambas-user] datediff to miliseconds

Gianluigi bagonergi at gmail.com
Mon May 13 20:09:44 CEST 2019


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 ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190513/b1a499b9/attachment-0001.html>


More information about the User mailing list