Does a day start at 1:00 AM everwhere?

Marian Petrides mpetrides at earthlink.net
Fri Oct 27 11:20:41 EDT 2006


While we are on the topic of dates, I've been thinking about creating  
a "countdown" calendar, clocking the number of days remaining between  
today's date and some future date (March 31, 20010 specifically).   
Any tips on how I can do this?  Do I have to convert dates into  
seconds in order to subtract one from the other?  Thanks.

On Oct 27, 2006, at 9:49 AM, Ken Ray wrote:

> On 10/27/06 7:52 AM, "Mark Powell" <mark_powell at symantec.com> wrote:
>
>> I have a user-specified date.  I want to convert it to seconds and
>> factor in 86400 to establish the range of seconds for that date,  
>> so that
>> I can compare a file's creation date to determine whether that  
>> file was
>> created on that specified day.  The problem is I am not sure what is
>> used as the starting point for a date's seconds counter.  At 6:42  
>> this
>> morning, I ran this:
>>
>>   put the short date into theDate
>>   convert theDate to seconds
>>   put ((the seconds - theDate) / 3600)
>>
>> and got 4.710556, which suggests that a date starts at 1:00 AM and  
>> not
>> midnight.  Is this accurate?  And more importantly, is this the  
>> way the
>> computation would be handled on any client machine anywhere?
>
> Welcome to the wonderful world of dates in Revolution!
>
> ;-)
>
> Seriously - Many of us have struggled with date arithmetic in Rev  
> as it
> relates to other parts of the world. The short answer is "no", it  
> is not
> always 1:00 AM everywhere when you convert a date to seconds and  
> back again.
> In fact for me, I get 2:00 AM.
>
> Date conversions give you different results depending on a number of
> factors: is Daylight Saving Time (DST) or Summer Hours currently being
> observed? What hemisphere are you on? Are you looking at a date  
> that is
> "across" a DST boundary (such as the current date being in March  
> and you're
> looking at a date in May, which is across the DST "boundary" in  
> April).
>
> I wish it were easier, but it's not... in your *specific* application,
> though, if you're just trying to compare one date to another, you  
> can strip
> off the time from the file creation date, and then convert the user- 
> entered
> date and the date from the file creation to seconds and compare - they
> should be the same:
>
>   put fld "UserDate" into tUserDate
>   put fld "FileCreationDateTime" into tFileDateTime
>   put word 1 of tFileDateTime into tFileDate
>    -- assumes a datetime where the date and time are separate by a  
> space
>   convert tUserDate to seconds
>   convert tFileDate to seconds
>   if tUserDate = tFileDate then
>     answer "Same day"
>   else
>     answer "Different day"
>   end if
>
> Will this work for you?
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Web site: http://www.sonsothunder.com/
> Email: kray at sonsothunder.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list