Re: Date-Time Formatting
Re: Date-Time Formatting
- Subject: Re: Date-Time Formatting
- From: "Marc K. Myers" <email@hidden>
- Date: Thu, 26 May 2005 19:01:10 -0400
Date: Thu, 26 May 2005 10:17:37 -0700
From: Jack Stewart <email@hidden>
Subject: Date-Time Formatting
To: "AppleScript User's List" <email@hidden>
I want to use Applescript to write a date. Does anyone know what I
need to do to alter the returned value from (current date) so that it
will give me a mm/dd/yyyy date format plus the time-of-day? if I do
"(current date) as text", I get the long format with day-of-week
spelled out, etc.
Feed the current date into this handler:
on formDate(theDate)
--get time 0 for the Unix side
set theEpoch to date (do shell script "date -r 0 +\"%a %b %e %Y
%H:%M:%S\"")
--current time in seconds from time 0, as text (for next bit)
set theDiff to (theDate - theEpoch) as text
--convert the any scientific notation to an "integer" string
if theDiff contains "E" then
set thePower to (last character of theDiff) + 1
set theDiff to (first character of theDiff & (characters 3 thru -4 of
theDiff as text))
repeat until (length of theDiff) = thePower
set theDiff to theDiff & "0"
end repeat
end if
--do the shell script
return (do shell script ("date -r " & theDiff & " +\"%m/%d/%G %T\""))
end formDate
Marc [5/26/05 7:00:01 PM]
_______________________________________________
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