on 5/21/03 1:37 PM, Mark Lively wrote:

>> For example, if I want to coerce a a string (i.e. "mmddyyyy") into a
>> date, I'm completely beholden to Tanaka's to do that.
>>
>> Any clues?
>>
> It can be done in vanilla applescript.  It won't be fast.
>
> on mm_to_date(aDate)
> if month of aDate = January then return "01"
> if month of aDate = February then return "02" ... <snip>

WOW! That's a mouthful of code! You're a lifesaver. But now I'm really
starting to mourn the loss of Tanaka's. The stampToDate command can handle a
string to date coercion as simply as this:

set dateString to "05212003"
set myDay to ((characters 3 thru 4 of dateString) as string)
set myMonth to ((characters 1 thru 2 of dateString) as string)
set myYear to ((characters 7 thru 8 of dateString) as string)
set myTime to "000000"
set myDate to StampToDate (myYear & myMonth & myDay & myTime)

- WES