At 03:03p -0500 05/21/2003, Eric Schult didst inscribe upon an
electronic papyrus:
>on 5/21/03 1:37 PM, Mark Munro wrote:
>
> > How about using unix to do that?
> >
> > do shell script "date '+%m.%d.%y'"
>
>I'm trying to coerce a string ("05212003") into a date (date "Wednesday, May
>21, 2003 12:00:00 AM"). Can that be done with a variation of the syntax
>above?
Not sure, but it's still easy (and fast) in vanilla AppleScript:
MMDDYYYY_to_Date("05212003")
on MMDDYYYY_to_Date(dstr)
local dstr, myDate
set myDate to (current date)
set year of myDate to text 5 thru 8 of dstr
set month of myDate to item (text 1 thru 2 of dstr) of ¬
{January, February, March, April, May, June, ¬
July, August, September, October, November, December}
set day of myDate to text 3 thru 4 of dstr
set time of myDate to 0
myDate
end MMDDYYYY_to_Date
|