Re: Date problems
Re: Date problems
- Subject: Re: Date problems
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 26 Aug 2002 13:38:58 -0700
On 8/26/02 1:16 PM, "John Delacour" <email@hidden> wrote:
>
At 8:07 am -1000 26/8/02, Reinhold Penner wrote:
>
>
> ...and now try this:
>
>
>
> tell application "Finder"
>
> set myDate to "Sun, 25 Aug, 2002 14:43:04"
>
> set myDate to date myDate
>
> end tell
>
>
>
> ...I have resorted to parse the string into an integer
>
> representation that I can use to compare dates numerically on both
>
> systems and have abandoned the date coercion.
>
>
What on earth has the Finder to do with it?
>
>
Do this...
>
>
set myDate to "Sun, 25 Aug, 2002 14:43:04"
>
set myDate to date myDate
>
>
or do this if you must...
>
>
tell application "Finder"
>
set myDate to "Sun, 25 Aug, 2002 14:43:04"
>
set myDate to my date myDate
>
end tell
>
>
>
You can see, if you look at the finder dictionary that date is a
>
constant in a suit that is only half-baked in 10.1.*, but it's a
>
golden rule never to include any terms that you don't need and do
>
work wherever possible OUTSIDE a tell block.
1. Reinhold has already explained a few times that he's in his own
AppleScript Studio app. All code in a Studio app is implicitly in a tell
block to itself. No way to avoid this. He was just using the Finder as an
example for others to try.
2. I have already reminded you a few times (although I didn't think you'd
have forgotten) that we used to have to write 'tell me to set the date to
date "anything"', when within an application tell block, and that this
seems to have returned in AS 1.8.3.
3. Reinhold is in a situation where he has to express it as a variable
because he doesn't know what date string the user will choose in his app.
Presumably the strings offered to the user are preset in English US, but the
user may have a different date format. Or maybe its just not predictable
what the user will do.
4. Reinhold has said that he has worked around that by using a numerical
format.
5. Chris has just explained (was it here or in AS Studio list?) that a bug
has been fixed in Jaguar so that the AppleScript date and NSDate (Cocoa)
forms coerce to each other now - not so in 10.1.x. That's the bug Reinhold
was running into.
--
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.