• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re:Date mathematics help please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Date mathematics help please


  • Subject: Re:Date mathematics help please
  • From: roy whelden <email@hidden>
  • Date: Sat, 18 Jan 2003 17:25:07 -0800

Hello SA,
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

display dialog "The difference is " & hoursDifference & " hours."

----------------------------
Hope this helps,
RMW
_______________________________________________
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.

  • Follow-Ups:
    • Re: Date mathematics help please
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: Command line text substitution
  • Next by Date: Curse of the Tongs
  • Previous by thread: Applescript simple dialogs in Studio
  • Next by thread: Re: Date mathematics help please
  • Index(es):
    • Date
    • Thread