[Gambas-user] Difference DateDiff(...) ?

d4t4full at ...626... d4t4full at ...626...
Sun Aug 6 16:30:39 CEST 2017


Without a machine nearby, I'd risk you're in the right track.

The DIM AS LONG creates 64bit vars while DateDiff may return 32bit data (don't have the docs with me).

Print will use 64bit to print the vars and 32bit with direct DateDiff (you may confirm by using CLng to affect the DateDiff's in the second Print)

Remember that when you have the most significant bit (MSB) set, Gambas will interpret the value as twos-complement sign and yield negative values.

Regards,
zxMarce.


On Aug 6, 2017, 10:21, at 10:21, Hans Lehmann <hans at ...3219...> wrote:
>Hello,
>Why are two different results:
>
>Public Sub Main()
>
>   Dim a, b As Long
>
>   a = DateDiff("01/01/1900", "01/01/1935", gb.Second)
>   b = DateDiff("01/01/1935", "01/01/1970 ", gb.Second)
>
>   Print a + b
>   Print DateDiff("01/01/1900", "01/01/1935", gb.Second) +
>DateDiff("01/01/1935", "01/01/1970 ", gb.Second)
>
>End
>
>Results:
>
>2208988800     ' ok
>-2085978496    ' complement?
>
>Best regards
>
>Hans
>------------------------------------------------------------------------------
>Check out the vibrant tech community on one of the world's most
>engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>_______________________________________________
>Gambas-user mailing list
>Gambas-user at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gambas-user



More information about the User mailing list