• 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: class reference "date" problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: class reference "date" problems


  • Subject: Re: class reference "date" problems
  • From: Jean-Christophe Helary <email@hidden>
  • Date: Wed, 22 Apr 2015 07:22:07 +0900

Thank you Chris and Yvan for the reply.

> On Apr 22, 2015, at 05:44, Christopher Stone <email@hidden> wrote:
>
> On Apr 21, 2015, at 09:24, Jean-Christophe Helary <email@hidden> wrote:
>> I found that the Applescript Language Reference does not seem to represent the date function properly
> ______________________________________________________________________
> ASLG:
>
> Special Considerations
>
> You can create a date object using a string that follows the date format specified in the Formats pane in International preferences.
>
> * Now in Language & Region (advanced)

Yes, I read that, and what I have in there is:
Monday, January 5, 2015 at 07:08:09 GMT+9

> The date object is not quite as forgiving as it used to be in figuring out what is meant by a specific date string.

I can see that, and I was expecting the reference to tell me *how* system values would affect it :)

> On my system (10.9.5):
>
> # date "05/04/1961 11:30" compiles to:
> date "Thursday, May 04, 1961 at 11:30:00 GMT-5"

Here it compiles to:
date "Thursday, May 4, 1961 at 11:30:00"

(notice the lack of GMT reference, even though I seem to have it in System preference...)


> If you want your date to be displayed just so then you have to create it yourself from the date object's parts:

What I am trying to do is to give a string to Applescript and have it convert it into a date that I can use as a boundary for a Calendar event.

I have (work) projects that I manage in Finder in folders for which I create a name like:

client_name_yy.mm.dd → mm.dd (extra information)

the first date format is the project starting day (usually "today") and the second one is the delivery day.

I created a function that converts "current date" to something like yy.mm.dd and another one that creates an Applescript date from a mm.dd string.

For the folder name, I'm fine with that, but for the Calendar event end boundary I need an hour that I arbitrarily set at 09:00.

And for some reason I could not get the hour to be recognized properly, hence my question here.

> But ask if you have specific needs.

I'd like to know how to find what string my system wants to compile to

date "Thursday, May 4, 1961 at 11:30:00"

> On Apr 22, 2015, at 01:36, Yvan KOENIG <email@hidden> wrote:

>> date "8/9/2007, 17:06"
>>     --result: date "Thursday, August 9, 2007 5:06:00 PM"
>>
>> but in Yosemite Applescript the result is:
>> 	date "Thursday, August 9, 2007 at 00:00:00"
>
> The problem is not the system but what you ask it to treat.
>
> "8/9/2007 17:06"
> date result
>
> behaves perfectly.
>
> The wrongdoer is your extraneous comma.

It is not "my" extraneous comma, it is the exemple given in the reference.

> If my memory is right, the changes in the way AppleScript treat dates was introduced in Lion or Mountain Lion.

Then why hasn't the reference been updated ? *Or* is there a way to find how my system impacts on what is valid and what is not ?

Jean-Christophe Helary
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Re: class reference "date" problems
      • From: Christopher Stone <email@hidden>
References: 
 >class reference "date" problems (From: Jean-Christophe Helary <email@hidden>)
 >Re: class reference "date" problems (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: class reference "date" problems
  • Next by Date: "Expected class name but found application constant or consideration"...
  • Previous by thread: Re: class reference "date" problems
  • Next by thread: Re: class reference "date" problems
  • Index(es):
    • Date
    • Thread