Re: Converting Date?
Re: Converting Date?
- Subject: Re: Converting Date?
- From: Nigel Garvey <email@hidden>
- Date: Tue, 27 Aug 2002 12:30:09 +0100
Jacki Barineau wrote on Mon, 26 Aug 2002 22:16:31 -0400:
>
set message_date to time sent of message i of folder "Workshop Notification
>
List" of folder "OO Mail" of folder "Inbox" as text
>
>
Returns the following:
>
>
Monday, August 26, 2002 12:28 AM
>
>
The following script code:
>
>
set entry_date to words 2 through 4 of message_date
>
>
Returns the following:
>
>
August: 26: 2002
It should return:
{"August", "26", "2002"}
It may be that you're coercing it to string while the text item
delimiters are set to {": "}.
>
Is there a way to either have the script bring in the correct date format to
>
begin with or to somehow edit the returned string to remove the ":"'s and
>
put the "," after the day number...?
set entry_date to text from word 2 to word 4 of message_date
Or the alternative wording:
set entry_date to text (word 2) thru (word 4) of message_date
This extracts the required section of message_date directly instead of
getting a list of the individual words. Of course, it only produces the
precise effect you want on machines whose 'Date & Time' settings follow
your particular date format. On other machines, message_date might be
arranged quite differently. (On mine, for instance, it would be: "Monday,
26 August 2002 00:28:00".) If you want to be sure that the final result
will be in month-day-comma-year format, this would be better:
set message_date to time sent of message i of folder "Workshop
Notification List" of folder "OO Mail" of folder "Inbox" -- NB. *not* as
text
set entry_date to (message_date's month as string) & " " &
message_date's day & ", " & message_date's year
NG
_______________________________________________
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.