On Thu, 13 Aug 2015 16:22:13 +0200 "Adrien Prokopowicz" <adrien.prokopow...@gmail.com> wrote:
> Le Mon, 10 Aug 2015 13:41:17 +0200, Jussi Lahtinen > <jussi.lahti...@gmail.com> 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 < > > gam...@users.sourceforge.net> 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 > > ------------------------------------------------------------------------------ > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user Confirmed at 7219 and I've added more output and tests: Dim FirstDate As Date Dim SecondDate As Date FirstDate = Date(2015, 1, 1, 0, 0, 0, 0) SecondDate = Date(2015, 8, 1, 00, 00, 00) Print "1 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" SecondDate = Date(2015, 8, 1, 00, 00, 01) Print "2 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" SecondDate = Date(2015, 8, 1, 03, 59, 59) Print "3 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" SecondDate = Date(2015, 8, 1, 04, 00, 00) Print "4 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" SecondDate = Date(2015, 8, 1, 11, 21, 51) Print "5 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" SecondDate = Date(2015, 8, 1, 23, 59, 59.99999999999) Print "6 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" SecondDate = DateAdd(firstdate, GB.Day, 2) Print "7 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" SecondDate = DateAdd(firstdate, GB.Day, 1) Print "8 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" SecondDate = DateAdd(firstdate, GB.Day, 0) Print "9 First:"; Format(FirstDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(FirstDate); ") Second:"; Format(SecondDate, "dd-mmm-yy hh:nn:ss:uu"); " ("; CFloat(SecondDate); ") Diff:"; DateDiff(firstdate, SecondDate, gb.day); " ("; CFloat(SecondDate) - CFloat(FirstDate); ")" gives : 1 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:01-Aug-15 00:00:00:000 (2489340.39583333) Diff:211 (212) 2 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:01-Aug-15 00:00:01:000 (2489340.39584491) Diff:212 (212.000011574011) 3 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:01-Aug-15 03:59:59:000 (2489340.56248843) Diff:212 (212.1666550925) 4 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:01-Aug-15 04:00:00:000 (2489340.5625) Diff:212 (212.166666666511) 5 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:01-Aug-15 11:21:51:000 (2489340.86934028) Diff:212 (212.473506944254) 6 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:01-Aug-15 23:59:59:000 (2489341.39582176) Diff:212 (212.999988425989) 7 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:03-Jan-15 00:00:00:000 (2489130.39583333) Diff:1 (2) 8 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:02-Jan-15 00:00:00:000 (2489129.39583333) Diff:0 (1) 9 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:01-Jan-15 00:00:00:000 (2489128.39583333) Diff:0 (0) Test #8 clearly shows the error. LATE NOTE: I've changed test #6 to SecondDate = Date(2015, 8, 1, 23, 59, 59, 1000) which gives: 6 First:01-Jan-15 00:00:00:000 (2489128.39583333) Second:02-Aug-15 00:00:00:000 (2489341.39583333) Diff:212 (213) (This may just be an artifact of the issue though) regards bruce -- B Bruen <adamn...@gnail.com (sort of)> ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user