Re: Date trouble
Re: Date trouble
- Subject: Re: Date trouble
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 20 Oct 2006 16:47:52 -0400
On 10/20/06, Barry Wainwright <email@hidden> wrote:
tell (current date) to (it's year as text) & "-" & (it's month as integer) &
"-" & it's day & " " & it's time string
No solution using "time string" will work because it's
locale-sensitive and might return 12-hour time with am/pm, and/or use
somehting other than colons between the components.
If you want an AS-only solution, you really have no choice but to use
time div hours etc and build it up yourself. Here's one way:
tell (current date)
set dlist to get {its year, its month as integer, its day}
set hour to (its time) div hours
set min to ((its time) - hour * hours) div minutes
set sec to ((its time) - hour * hours - min * minutes)
set tlist to {hour, min, sec}
end tell
set |current time| to join(" ", join("-", dlist), join(":", tlist))
on join(delim, l)
set |old delimiters| to text item delimiters
set text item delimiters to delim
set |result string| to l as text
set text item delimiters to |old delimiters|
return |result string|
end join
Of course, if you have a handy osax that provides the equivalent of
that join() handler, you can use that instead.
--
Mark J. Reed <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/mailman//archives/applescript-users
This email sent to email@hidden