diffdays

Richard Gaskin ambassador at fourthworld.com
Thu Jul 18 00:18:01 EDT 2002


>> You have entered a SHORT date for DateA but then the conversion is
>> done from a LONG date. Change the first convert line to say "from
>> system short date" or "from short date" and it should work fine.
>> 
>> Sarah
> 
> I changed it as follows but it still puts 730 days.
> 7/17/1900  to  7/17/2002  is a bit more days than that.
> 
> sims
> 
> on mouseUp
> put "7/17/1900" into DateA
> convert DateA from  short date to seconds
> put "7/17/2002" into DateB
> convert DateB from short date to seconds
> put DateA - DateB into diff
> divide diff by 86400 -- No of seconds in 1 day
> if char 1 of diff = "-" then delete char 1 of diff
> put diff
> end mouseUp

See the centuryCutoff global property im the Rev docs.

The core of the problem reflects a limitation of the date routines in most
OSes (the original Mac OS, for example, natively handles date ranges from
1904 to 2042). 

The solution is to use Julian dates.

This was the topic of a long thread on the MetaCard list last fall.  Perhaps
the most complete algorithm was listed in this message:

<http://www.mail-archive.com/metacard@lists.runrev.com/msg04054.html>

You may also want to search for "Julian" in the MetaCard List archives to
get some more detailed background info on the issues involved.

Would be nicer to have DateToJulian and JulianToDate functions built into
the engine....

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 2.0: Publish any Database on Any Site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc




More information about the use-livecode mailing list