On 05/12/10 01:08, Werner wrote: > On 05/12/10 00:37, Benoît Minisini wrote: > >>> 2010/2/13 Benoît Minisini <gam...@users.sourceforge.net>: >>> >>> >>>>> I've run into a strange problem with the DateAdd function, when trying >>>>> to subtract from the current date by months. >>>>> >>>>> I initially hit the problem with the following (values are hard-coded >>>>> for clarity): >>>>> DateAdd(cdate("2/13/2010"),gb.month,-37) >>>>> >>>>> It seems that any combination of Date and Interval that results in a >>>>> date of January 2007 causes an "Invalid Date" error. For example, the >>>>> following are all invalid: >>>>> DateAdd(cdate("1/13/2010"),gb.month,-36) >>>>> DateAdd(cdate("2/28/2010"),gb.month,-37) >>>>> DateAdd(cdate("3/13/2010"),gb.month,-38) >>>>> >>>>> Changing the starting date or the number of intervals so as to have a >>>>> date that falls outside the month of January 2007 works okay. It also >>>>> works okay using periods of Year or Week that fall into those dates. >>>>> >>>>> ======= >>>>> >>>>> System information: >>>>> >>>>> Gambas Version 2.13 >>>>> Components in project: gb.db, gb.db.form, gb.form, gb.gui, gb.settings, >>>>> gb.vb >>>>> >>>>> OS: Ubuntu 9.10 Karmic Koala; Kernel 2.6.31-19-generic-pae >>>>> GNOME 2.28.1 >>>>> >>>>> Hardware: Intel Core 2 Duo processor (E8400) >>>>> >>>>> >>>> The bug has been fixed in revision #2697. >>>> >>>> Regards, >>>> >>>> -- >>>> Benoît Minisini >>>> >>>> >>> This is a reply to and old post, but I'd gone off onto other projects, >>> and am just revisiting this... >>> >>> I am currently running version 2.22.0 and am still getting the error >>> described above. If the bug had been fixed in an earlier version, it >>> seems to have crept back in. >>> >>> My Ubuntu version is currently 10.04 LTS (Lucid Lynx) >>> >>> Thanks, >>> >>> -George >>> >>> >>> >> Can anyone reproduce that? >> >> I can't. I get the correct result each time with gambas 2.22.0. >> >> ?DateAdd(cdate("1/13/2010"),gb.month,-36) >> 13/01/07 >> ?DateAdd(cdate("2/28/2010"),gb.month,-37) >> 28/01/07 >> ?DateAdd(cdate("3/13/2010"),gb.month,-38) >> 13/01/07 >> >> >> > Gambas 2.19/64 Suse11.3 locale Hong Kong: > > PRINT DateAdd(CDate("2/13/2010"), gb.month, -36) > PRINT DateAdd(CDate("3/28/2010"), gb.month, -37) > PRINT DateAdd(CDate("4/13/2010"), gb.month, -38) > produces > 13/02/07 > 28/02/07 > 13/02/07 > > whereas > PRINT DateAdd(CDate("1/13/2010"), gb.month, -36) > PRINT DateAdd(CDate("2/28/2010"), gb.month, -37) > PRINT DateAdd(CDate("3/13/2010"), gb.month, -38) > all produce an invalid date error. > > Regards > Werner > Forgot to mention it works in Gambas3 version 3293.
------------------------------------------------------------------------------ What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user