Re: Coerce Text to Date
Re: Coerce Text to Date
- Subject: Re: Coerce Text to Date
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 11 Dec 2002 16:03:04 -0800
On 12/11/02 1:35 PM, "Chris Prew" <email@hidden> wrote:
>
Hi, I have a text variable in a date format that I need to convert to a
>
true date format so i can manipulate it as a date. Whats the best way
>
to do this? I've tried lots of ways with no success.
>
>
My text variable is named the_text, and the value is (for example)
>
"10/17/2002". So...
>
>
set the_new_date to date (the_text)
>
>
doesn't seem to work, nor does (the_text) as date or anything else.
>
I've also tried turning the text into a single list item with no
>
success.
>
>
This is probably a really simply question, but I can't figure it out.
>
Thanks in advance
That's the correct method [date theText], but you're probably trying to do
it inside an application tell block. Except for one or two versions of
AppleScript (1.8 through 1.8.3 or 1.8.2) that doesn't work. Either do it
outside a tell block or use the magic words:
tell me to set newDate to date theText
('me' directs the command to the script itself.) Also, you'd better be sure
that the computer running the script has the same mm/dd/yy short date format
as you do, or accommodate for other possibilities.
--
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.