Working with seconds, what am I missing?

Mike Bonner bonnmike at gmail.com
Sun Apr 22 17:04:05 EDT 2012


You are correct, its a matter of daylight savings time. I believe "the
date" converted to seconds turns into the seconds representing the first
moment of that date IE midnight. Then there is an adjustment for daylight
saving time.

The easiest way around this (if you only care about the date itself not
being specific to an hour) is to change your first line to something like..
put the date && "12:00 PM" into tDate

This way DST becomes a non issue for the seconds to dates.

On Sun, Apr 22, 2012 at 2:55 PM, Andrew Henshaw <henshaw at me.com> wrote:

> Trying to work with seconds to avoid format issues with dates in different
> countries I keep running into this issue,  and im probably just missing
> something very obvious!
>
> Using the following simple code today (the 22nd April)..
>
>   put the date into tDate
>   convert tDate to seconds
>   put tDate
>
> Returns 1335049200
>
> Id expect to get a result of 22nd April,  but instead Ive fed that in to a
> few online UNIX time converters and they all return Sat, 21 Apr 2012
> 23:00:00 GMT which is an hour into the previous day.
>
> Im assuming its something to do with GMT / daylight savings time,  but is
> there a reliable way to get and use the seconds.  Id like to ensure the
> values stored are correct.
>
> Andy
> _______________________________________________
> 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