• 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: Christopher Stone <email@hidden>
  • Date: Tue, 21 Apr 2015 15:44:55 -0500

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 
______________________________________________________________________

Hey Jean-Christophe,

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)

--

The date format is affected by your system date format.

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

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"

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

set {year:y, month:m, day:d, hours:hrs, minutes:min, seconds:sec} to current date

set dStr to "05/04/1961 at 11:30"
set d to date dStr
set seconds of d to 10

tell d
set {y, m, mStr, d, tStr} to {year, its month as number, its month as text, day, time string}
end tell

--> {1961, 5, "May", 4, "11:30:10 GMT-5"}

You'll find a lot of discussion about dates on the list by searching with Google:

nigel garvey "current date" site:http://lists.apple.com/archives/applescript-users

But ask if you have specific needs.

--
Best Regards,
Chris

 _______________________________________________
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: Jean-Christophe Helary <email@hidden>
References: 
 >class reference "date" problems (From: Jean-Christophe Helary <email@hidden>)

  • Prev by Date: class reference "date" problems
  • Next by Date: Re: class reference "date" problems
  • Previous by thread: class reference "date" problems
  • Next by thread: Re: class reference "date" problems
  • Index(es):
    • Date
    • Thread