Re: Applescript-users Digest, Vol 2, Issue 175
Re: Applescript-users Digest, Vol 2, Issue 175
- Subject: Re: Applescript-users Digest, Vol 2, Issue 175
- From: Stefan Eriksson <email@hidden>
- Date: Tue, 15 Mar 2005 20:59:57 +0100
Here is another way to do it...
set Unixdate to (do shell script "date +%y%m%d")
set Unixtime to (do shell script "date +%H%M%S")
then all you have to do is parse it together or make the code to one line.
Not sure about the system resources needed for this routine compared to the previous offered tho...
Cheers, Stefan
------------------------------
Message: 4
Date: Mon, 14 Mar 2005 12:55:08 -0800
From: Todd Geist <email@hidden>
Subject: Time Stamp String
To: Applescript List <email@hidden>
Message-ID: <BE5B3A2C.19B96%email@hidden>
Content-Type: text/plain; charset="US-ASCII"
Hello Everyone,
I wanted to create a routine that would take the current date and return it
in the form
yyyymmdd_time
Ex
20050314_46211
I created this script which works just fine but I was wondering if there was
a better way.
_____________________________
on TimeStampString(theDate)
set theTS to theDate
set tid to text item delimiters
set text item delimiters to ""
set theYear to the year of theTS
set theDay to day of theTS as text
--pad the day number to 2 digits
set theDay to "0" & theDay as text
set theDay to items ((count of theDay) - 1) through (count of theDay) of
theDay
set theMonth to the month of theTS as number
--pad the month number to 2 digits
set theMonth to "0" & theMonth as text
set theMonth to items ((count of theMonth) - 1) through (count of
theMonth) of theMonth
set theTime to time of theTS
set theFullString to theYear & theMonth & theDay & "_" & theTime as text
return theFullString
set text item delimiters to tid
end TimeStampString
_____________________________
Thanks
Todd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden