Re: Simple Date-Time Format Question...
Re: Simple Date-Time Format Question...
- Subject: Re: Simple Date-Time Format Question...
- From: Philip Aker <email@hidden>
- Date: Tue, 24 Apr 2007 22:03:34 -0700
On 2007-04-24, at 18:51:19, revDAVE wrote:
Novice question #2
I would like to set a date-time like:
"4-24-2007 6-41-07 PM"
I don't know how to say it in 'applescript' - something like...?
I'm not sure exactly what you're asking. If you want to _get_ a
formatted date string from an AppleScript 'date' it's:
set d to (current date)
"" & year of d & "-" & (month of d as integer) & "-" & day of d & " "
& hours of d & "-" & minutes of d & "-" & seconds of d
or
do shell script "date +'%F %H-%M-%S'"
However I suspect what you really want to be using is a variant of
the ISO standard date format. If so then there are some other choices:
do shell script "date +'%F %T'"
or perhaps:
set isot to ((current date) as «class isot») as text
set tids to AppleScript's text item delimiters
set AppleScript's text item delimiters to "T"
set res to text items of isot
set AppleScript's text item delimiters to tids
item 1 of res & space & item 2 of res
Cheers,
Philip Aker
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden