• 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: Getting the time of day
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the time of day


  • Subject: Re: Getting the time of day
  • From: Steve Roy <email@hidden>
  • Date: Wed, 24 Sep 2003 10:47:40 -0400

Lyle Petro <email@hidden> wrote:

> I would like to be able to determine the time of day via AppleScript. Am I
> missing something simple, or is a little mathematical magic involved?

You can get 'time of (current date)', which will give you the number of seconds
since the beginning of the day. From there, you can use whatever calculations
you need.

set theSeconds to time of (current date)
set theHours to round (theSeconds / (60 * 60)) rounding down
set theSeconds to theSeconds mod (60 * 60)
set theMinutes to round (theSeconds / 60) rounding down
set theSeconds to theSeconds mod 60
"" & theHours & ":" & theMinutes & ":" & theSeconds
--> "10:47:16"

Steve

--
Steve Roy <email@hidden>
Personal homepage: <http://homepage.mac.com/sroy>
Projects homepage: <http://www.roydesign.net>
_______________________________________________
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.

References: 
 >Getting the time of day (From: "Lyle Petro" <email@hidden>)

  • Prev by Date: Re: Getting the time of day
  • Next by Date: Re: Image thumbnails question
  • Previous by thread: Re: Getting the time of day
  • Next by thread: Re: Getting the time of day
  • Index(es):
    • Date
    • Thread