• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: date of question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: date of question


  • Subject: Re: date of question
  • From: Emile Schwarz <email@hidden>
  • Date: Fri, 14 Oct 2005 10:22:20 +0200

Hi all,

1. Complement to what have been said (see below):

once you put the two following lines and press Enter (to check the syntax), you will get a different AppleScript source...

Original AppleScript:
set EventStartDate to date "10/20/05"
set EventEndDate to (EventStartDate) + 3600


Corrected AppleScript (after the syntax checking): set EventStartDate to date "Thursday, October 20, 2005 0:00:00 AM" -- see (*) set EventEndDate to (EventStartDate) + 3600


(*) in fact, this is a guess from Paul below answer.


2. Information for domestic and non US users (or users with different Clock settings).


When I put the original AppleScript, my French Mac OS X (10.3.9) says:


set EventStartDate to date "vendredi 14 octobre 2005 10:20:05" -- see (*) set EventEndDate to (EventStartDate) + 3600


and the result is 1 hour later (the second line adds 3600 seconds - 1 hour -).

(*) My Clock setting uses the French legal time setting: DD-MM-YYYY.
The US translation is: Friday, October 14, 2005 10:20:05 [morning, don't remember if this is AM or PM, sorry]


Don't ask me why I get today date (the passed date is null ?).
Easy to test, so yes, I get today's date because the passed date is invalid. The following date format goes well:


set EventStartDate to date "10/20/05"

is translated to:
set EventStartDate to date "jeudi 20 octobre 2005 0:00:00"

and the returned value is:
date "jeudi 20 octobre 2005 0:00:00"


3. Last information on this subject:

Passing a US date gives me an error on _MY French 10.3.9_ so the reverse is certainly true.


I spend some times last week on this subject and found the AppleScript Reference Manual (old) Date Class entry less than satisfactory on that subject.
A whole rewrite is welcome (some people at the "writing manual department" have to read back the AppleSoft BASIC Manuals and learn how Apple wrote very informative and accurate manuals 20 years ago)... Of course, critics are easy do do...


HTH,

Emile


--- answer to:
From: Paul Berkowitz <email@hidden>
Subject: Re: date of question
To: AppleScript-Users <email@hidden> Message-ID: <BF73F520.B4E23¾email@hidden> Content-Type: text/plain; charset="US-ASCII" On 10/13/05 11:13 AM, "Robert Poland" <email@hidden> wrote:


>> Trying to get date of "10/20/05".
>>
>> set EventStartDate to "10/20/05"
>> set EventEndDate to (EventStartDate) + 3600
>> EventEndDate
>>
>> I think I have learned how to get any part of a date but can't figure
>> out how to go back.


You left out 'date' before your short date string, so it hasn't compiled as a date. You can't use a string. You can't really do AppleScript at all without knowing that.

set EventStartDate to date "10/20/05"
set EventEndDate to (EventStartDate) + 3600
EventEndDate
--> date "Thursday, October 20, 2005 1:00:00 AM"



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: date of question
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: system events XML suite -- it seems to be caching and holding XML objects
  • Next by Date: Re: system events XML suite -- it seems to be caching and holding XML objects
  • Previous by thread: Re: date of question
  • Next by thread: Re: date of question
  • Index(es):
    • Date
    • Thread