• 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 computation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date computation


  • Subject: Re: Date computation
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 7 Jan 2005 09:36:24 -0700

On Jan 7, 2005, at 3:48 AM, cheshirekat wrote:

to getNextMonth from the d
  set the cMonth to (the month of (the d))
  repeat with i from 1 to 12
    if the monthList's item i is the cMonth then
      if i is 12 then
        return {(the monthList's item 1), true}
      else
        set the nextNum to i + 1
        return {(the monthList's item nextNum), false}
      end if
    end if
  end repeat
end getNextMonth

Wouldn't this be a bit better (with panther):

property monthList : {January, February, March, April, May, June, July, ¬
August, September, October, November, December}
to getNextMonth from the d
set cMonth to month of d
if cMonth is 12 then
set year of d to (year of d) + 1
set month of d to January
else
set month of d to (item (cMonth + 1) of the monthList)
end if
return d
end getNextMonth


I also incremented the year if nextMonth is January, so there isn't a need to test for it anywhere else in the script. Also, I returned the entire date, so it doesn't have to be reconstructed anywhere else.

I'll need to review the rest of the script and everyone else's before making any more comments.

-- Michelle

--
If you don't hit any bumps in the road, you're not moving.

_______________________________________________
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: 
 >Date computation (From: Michelle Steiner <email@hidden>)
 >Re: Date computation (From: cheshirekat <email@hidden>)

  • Prev by Date: RE: ftp chokes my mac....
  • Next by Date: Re: Date computation
  • Previous by thread: Re: Date computation
  • Next by thread: Re: Date computation
  • Index(es):
    • Date
    • Thread