Re: Coerce time
Re: Coerce time
- Subject: Re: Coerce time
- From: kai <email@hidden>
- Date: Wed, 20 Aug 2003 23:30:57 +0100
on Wed, 20 Aug 2003 14:42:38 -0500, Rich Carroll <email@hidden> wrote:
>
Is there a simple way to coerce "August 20, 2003" to 08/20/03?
>
I can figure out a complicated series of steps to do it "manually," I'm just
>
hoping someone knows a better way.
A vanilla solution would require several steps, Rich. You'll probably get a
few suggestions - but here's one way:
-------------------------------------------------------
(Any wrapped lines abutting the left edge of the window
should be reconnected to the end of the previous line)
-------------------------------------------------------
--=====================
on shortDate(dateStr)
set {month:m, day:d, year:y} to date dateStr
set t to text item delimiters
set text item delimiters to (m as string)'s text 1 thru 3
set m to (count ("JanFebMarAprMayJunJulAugSepOctNovDec"'s text item 1))
div 3 + 1
set text item delimiters to t
("0" & m)'s text -2 thru -1 & "/" & ("0" & d)'s text -2 thru -1 & "/" &
(y as string)'s text -2 thru -1
end shortDate
--=====================
shortDate("August 20, 2003")
--> "08/20/03"
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.