Created
July 6, 2013 22:50
-
-
Save ROldford/5941583 to your computer and use it in GitHub Desktop.
Applescript method for creating time stamps. Great for use with filenames! Adapted from MacScripter (http://macscripter.net/viewtopic.php?id=24737)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to timeStamp(theDate) -- theDate must be date object | |
set separator to "-" -- can be changed to whatever you prefer | |
set y to year of theDate | |
set m to month of theDate | |
set d to day of theDate | |
set t to time of theDate | |
set dateNumber to (y * 10000 + m * 100 + d) | |
set tempDateString to dateNumber as string | |
set dateString to text 1 thru 4 of tempDateString & separator & text 5 thru 6 of tempDateString & separator & text 7 thru 8 of tempDateString & separator & t | |
return dateString | |
end timeStamp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment