[Gambas-user] datediff problem

Adrien Prokopowicz adrien.prokopowicz at ...626...
Thu Aug 13 16:22:13 CEST 2015


Le Mon, 10 Aug 2015 13:41:17 +0200, Jussi Lahtinen
<jussi.lahtinen at ...626...> a écrit:

> Sorry to say, but this doesn't seem to be fixed.
>
> ? DateDiff(Now, DateAdd(Now, gb.Day, 2), gb.Day)
> 1
>
>
> Jussi
>
> On Sat, Aug 1, 2015 at 7:16 PM, Benoît Minisini <
> gambas at ...1...> wrote:
>
>> Le 01/08/2015 17:52, Benoît Minisini a écrit :
>> > Le 01/08/2015 17:33, nando a écrit :
>> >> Here's an example.
>> >>
>> >>    Dim FirstDate as Date
>> >>
>> >>    FirstDate = Date(2015, 1, 1, 0, 0, 0, 0)
>> >>    Print DateDiff(firstdate, Date(2015, 8, 1, 00, 00, 00), gb.day)   
>> 'ok
>> >>    Print DateDiff(firstdate, Date(2015, 8, 1, 00, 00, 01), gb.day)   
>> 'ok
>> >>    Print DateDiff(firstdate, Date(2015, 8, 1, 03, 59, 59), gb.day)   
>> 'ok
>> >>    Print DateDiff(firstdate, Date(2015, 8, 1, 04, 00, 00), gb.day)
>> >> 'Wrong
>> >>    Print DateDiff(firstdate, Date(2015, 8, 1, 11, 21, 51), gb.day)
>> >> 'Wrong
>> >>
>> >> 212
>> >> 212
>> >> 212
>> >> 213  <---Wrong  should be 212
>> >> 213  <---Wrong  should be 212
>> >>
>> >> Of course, this is looks like it might be a TimeZone problem.
>> >> I am in GMT -5 but daylight savings during the summer it is -4
>> >>
>> >> Am I correct to say this is not correct operation?
>> >>
>> >> -Nando
>> >>
>> >>
>> >
>> > Argh, a just too late bug! You did that to spoil my holidats? 8-o
>> >
>>
>> OK, I couldn't let you alone. I have updated the Gambas 3.8 source
>> package with the fix for that bug.
>>
>> Regards,
>>
>> --
>> Benoît Minisini

That's weird, but the examples given (both jussi's and nando's) all work
correctly before Benoît's fix (pre-7212), but not after (post-7212) !

Am I missing something completely obvious, or do you get the same behavior
?

Here's my test code :

Dim FirstDate As Date

     FirstDate = Date(2015, 1, 1, 0, 0, 0, 0)
     Print DateDiff(firstdate, Date(2015, 8, 1, 00, 00, 00), gb.day)
     Print DateDiff(firstdate, Date(2015, 8, 1, 00, 00, 01), gb.day)
     Print DateDiff(firstdate, Date(2015, 8, 1, 03, 59, 59), gb.day)
     Print DateDiff(firstdate, Date(2015, 8, 1, 04, 00, 00), gb.day)
     Print DateDiff(firstdate, Date(2015, 8, 1, 11, 21, 51), gb.day)
     Print DateDiff(firstdate, DateAdd(firstdate, GB.Day, 2), GB.Day)

Output (Before 7212) :

212
212
212
212
212
2

Output (After 7212) :

211
212
212
212
212
1

-- 
Adrien Prokopowicz




More information about the User mailing list