Re: Converting Date?
Re: Converting Date?
- Subject: Re: Converting Date?
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 27 Aug 2002 12:10:32 -0700
On 8/27/02 11:47 AM, "Jacki Barineau" <email@hidden> wrote:
>
I'm assuming it might be even easier to get the date in the MM/DD/YYYY
>
format - or hoping anyway! Here's what I have in my date part of the
>
script now:
>
>
set message_date to time sent of message i of folder "Workshop Notification
>
List" of folder "OO Mail" of folder "Inbox"
>
>
set entry_date to ((month of message_date) as string) & " " & day of
>
message_date & ", " & year of message_date
>
>
(No Breaks)
>
>
How would I need to alter this to get the other format?
>
You'll need to convert the month to an integer. there are a number of ways
of doing that, especially if you're in OS X where 'do shell script' can get
it easily. Otherwise:
set theMonths to {January, February, March, April, May, June, July,
August, September, October, November, December}
set monthIndex to (my CollectUniqueItemIndex(theMonths, month of
message_date)) as string
set entry_date to monthIndex & "/" & day of
message_date & "/ " & year of message_date
to CollectUniqueItemIndex(theList, theItem) -- the Item can be string,
number, constant, app object or list
set theIndex to 0
repeat with i from 1 to (count theList)
set aListMember to item i of theList
if aListMember = theItem then
set theIndex to i
exit repeat
end if
end repeat
return theIndex
end CollectUniqueItemIndex
-------------------
(CollectUniqueItemIndex is a handy routine to keep around. There are ways of
optimizing it for very long lists. Ask.)
--
Paul Berkowitz
_______________________________________________
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.