Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Days and hours



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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.