Re: Date trouble
Re: Date trouble
- Subject: Re: Date trouble
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 20 Oct 2006 17:08:55 -0400
Whups, forgot about zero-padding the numbers. Again, various osaxen
(or Smile) make this a lot easier...
tell (current date)
set dlist to {¬
my pad(get its year, 2), ¬
my pad(its month as integer, 2), ¬
my pad(get its day, 2)}
tell its time
set hour to my pad(it div hours, 2)
set min to my pad((it - hour * hours) div minutes, 2)
set sec to my pad(it - hour * hours - min * minutes, 2)
end tell
end tell
set |current time| to join("-", dlist) & " " & ¬
join(":", {hour, min, sec})
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
on pad(num, digits)
set |result string| to num as string
repeat while length of |result string| < digits
set |result string| to "0" & |result string|
end repeat
return |result string|
end pad
_______________________________________________
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