MACSCRPT Archives

May 2003

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Walter Ian Kaye <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 21 May 2003 17:49:10 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
At 04:58p -0700 05/21/2003, Walter Ian Kaye didst inscribe upon an 
electronic papyrus:

>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

Oops, had to add one line (day of the month must be temporarily set < 29).

on MMDDYYYY_to_Date(dstr)
    local dstr, myDate
    set myDate to (current date)
    set day of myDate to 1
    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


-boo
  fun with date objects! struct your stuff, dudes ;)

ATOM RSS1 RSS2