Date bug?

Mike Bonner bonnmike at gmail.com
Fri Dec 7 14:27:45 EST 2012


There is strangeness sometimes due to system settings for daylight savings,
etc. Since "10/30/10" is actually determined as "10/30/10 12:00 AM" an
hours difference can cause problems similar to what you're seeing.  Why
does it behave this way on some dates and not others?  No clue.

If you want to see what is occurring so that you can confirm, if you
convert adate to long time and look at what is returned it will most likely
be 11:00 PM.

There are a few ways around this.  Define your time to convert as a date
and time set to noon. Or add 25 hours to the seconds rather than 24.  Or
use dateitems instead.

Dateitems is by far the easiest.

put "10/31/10" into aDate
convert aDate to dateitems
add 1 to item 3 of aDate
convert aDate to short time
return aDate


On Fri, Dec 7, 2012 at 12:02 PM, Mats Åström <matsastrom at yahoo.se> wrote:

> I have a simple script that adds one day to a date and returns the next
> date.
> I expect this to return 11/1/12, and it does:
>
> put"10/31/12"intoaDate
> convertaDate toseconds
> add 86400 to aDate
> convert aDate to short date
> return aDate
>
> But change "10/31/12" to "10/31/10" - it returns 10/31/10
> It does not add a day - instead it returns the same date.
> The same thing happens for these years (maybe some more, I have only
> tested from 1970 to 2051):
> 1999, 2004, 2010, 2021, 2027, 2032
>
> Can anybody confirm?
>
> /Mats
>
> "Change is the price for survival"
> /Gary Player
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list