Time Calculations

Ken Ray kray at sonsothunder.com
Mon Feb 6 11:51:25 EST 2006


On 2/6/06 10:18 AM, "Gregory Lypny" <gregory.lypny at videotron.ca> wrote:

> Hello everyone,
> 
> I want to confirm that, bugs aside, time calculations can only be
> done using the dateItems.  I ask this because the following
> inequality gives me the wrong answer when using a twelve hour clock.
> 
> set the twelveHourTime to true
> if "3:45 PM" >= "4:10 AM"
> then
> put "Later"
> else
> put "Earlier"
> end if

Well, you can use dateItems, or some other date format, but when you do
"3:45 PM" and "4:10 AM" (in quotes), they become strings and then you are
doing a string comparison.

This works too:

put "3:45 PM" into date1
put "4:10 AM" into date2
convert date1 to date
convert date2 to date
put date1 >= date2

--> true


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list