Re: Date mathematics help please...
Re: Date mathematics help please...
- Subject: Re: Date mathematics help please...
- From: Deivy Petrescu <email@hidden>
- Date: Sun, 19 Jan 2003 00:54:27 -0500
At 17:51 -0600 1/18/03, montana wrote:
Hi Everyone-
I would like to take a start date/time like:
1.14.03 2100
And an end date/time like;
1.17.03 2130
I want to then take these two times and find their difference and
return the difference value in hours and minutes. (Diff -> 72h 30min)
Does anyone know how to do this totally in AppleScript? I've written
scripts in both Python and Java that accomplish this (with Python
taking much less lines of code than Java to accomplish this task:))
but I would like to do this totally in AppleScript to access some of
the gui features of OSX without alot of code; i.e. Dialogs.
Thanks.
SA
:)
hi,
I came up with this. You can see the pattern:
set l to date "Tuesday, January 14, 2003 21:00:12"
set m to date "Friday, January 17, 2003 21:30:00"
set ktime to m - l
if ktime < 0 then set ktime to ktime * -1
return ((ktime / 3600) div 1 & " hours, " & ((ktime / 3600) mod 1 *
60) div 1 & " min and " & ((ktime / 3600) mod 1 * 60) mod 1 * 60
div 1 & " sec ") as string -- one line
---> "72 hours, 29 min and 48 sec "
Regards
--
Deivy Petrescu
http://www.dicas.com
_______________________________________________
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.