• 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: Time/Date stamping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Time/Date stamping


  • Subject: Re: Time/Date stamping
  • From: Bill Briggs <email@hidden>
  • Date: Fri, 9 Aug 2002 13:25:21 -0300

At 9:48 AM -0600 09/08/02, Jeff Davison wrote:
Is there a way to get the current time down to the second to be included in
a variable?

I would like to add the current time to a file name and I am unclear on what
the best solution would be.

For example: "Filename10:23:34:02:12:02"

old code from the archive of snippets. watch the line breaks. This uses "." delimiters for time and date and a colon between, just so you actually can see what's what. But you can do what you want with it. Just stick the thing on the end of your desired filename.

- web

set todaysDate to (current date)
set {d, m, y} to {day, month, year} of todaysDate
set monthList to {January, February, March, April, May, June, July, August, September, October, November, December}
set tTime to time of (current date)
set hrs to tTime div 3600 as text
set mins to (tTime mod 3600) div 60 as text
set secs to (tTime mod 3600) mod 60 as text
--{hrs, mins, secs}
repeat with i from 1 to 12
if m = (item i of monthList) then
set monthString to text -2 thru -1 of ("0" & i)
exit repeat
end if
end repeat
set dayString to text -2 thru -1 of ("0" & d)
set todaysDate to hrs & "." & mins & "." & secs & ":" & dayString & "." & monthString & "." & y
_______________________________________________
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: 
 >Time/Date stamping (From: Jeff Davison <email@hidden>)

  • Prev by Date: Re: AppleScript at a Glance
  • Next by Date: Re: Time/Date stamping
  • Previous by thread: Time/Date stamping
  • Next by thread: Re: Time/Date stamping
  • Index(es):
    • Date
    • Thread