Re: Date mathematics help please
Re: Date mathematics help please
- Subject: Re: Date mathematics help please
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 18 Jan 2003 17:36:53 -0800
On 1/18/03 5:25 PM, "roy whelden" <email@hidden> wrote:
>
Dates are very convenient to work with in Applescript. Here is an
>
example which should answer your question.
>
-------------------------------
>
>
set x to date "Tuesday, January 14, 2003 12:00:00 AM"
>
set y to date "Friday, January 17, 2003 12:00:00 AM"
>
>
set z to y - x --this returns the difference in seconds
>
>
set hoursDifference to z div hours --(1) use div to return an integer;
>
(2) hours is an Applescript constant. Days,weeks, and minutes are also
>
Applescript constants
To get the minutes, continue:
set secsLeftOver to z mod hours
set minutesPart to secsLeftOver div minutes
set secsLeftOver to secsLeftOver mod minutes
You may not need the seconds, I seem to recall.
'mod' gives the remainder, 'minutes' is simply a shorthand constant for 60,
and hours a constant for 3600, etc.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.