• 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: Days and hours
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Days and hours


  • Subject: Re: Days and hours
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 19 Oct 2005 23:48:51 -0400

On 10/19/05, Nigel Garvey <email@hidden> wrote:
>set myDate to current date
>set year of myDate to 1968
>set month of myDate to May
>set day of myDate to 5
>set time of myDate to (20 * 60 + 47) * 60

There's a potential problem with this method, in that unless all the
elements of the current date are compatible with the date you want to
create, you'll get errors.

Not errors, unless you mean "potentially erroneous results".  AppleScript automatically adjusts to legal dates.

If the script's run on 29th February 2008, the
second line will error if the target's in a non-leap year.

Nope.  It will just adjust the rest of the date to March 1st.
 

  tell (current date) to set {day, year, its month, day, time, myDate} to
{1, 1968, May, 5, 20 * hours + 47 * minutes, it}

 I do like that method, however.  Nice and (relatively) succinct.  Thanks!

--
Mark J. Reed <email@hidden>
 _______________________________________________
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

References: 
 >Re: Days and hours (From: "Nigel Garvey" <email@hidden>)

  • Prev by Date: Re: About This Mac
  • Next by Date: Re: Slow script with long lists
  • Previous by thread: Re: Days and hours
  • Next by thread: Re: Days and hours
  • Index(es):
    • Date
    • Thread