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

Re: Date question with weeknumber


  • Subject: Re: Date question with weeknumber
  • From: "Mark J. Reed" <email@hidden>
  • Date: Fri, 23 Apr 2010 13:07:58 -0400

On Fri, Apr 23, 2010 at 12:37 PM, <email@hidden> wrote:
set weekCount to 2
set startDate to (current date)
if startDate + (weekCount * weeks) > (current date) then

That will always be true; 2 weeks from now is always later than now.  Did you mean to compare the year values?  Even if so, I'm not sure what the goal of that hunk of code is. 

set whatDay to weekday of calculatedDate as integer

Oddly, you don't need the 'as integer' there ( though I agree it's clearer with it), while you do need it if you use the constant names.  Even so, I think this next line is clearer with the name instead of the number:
 
 set toWed to 4 - whatDay

set toWed to (Wednesday as integer) - whatDay

Your solution should work other than always pushing into next year, but it assumes that week 1 of the year is the week containing January 1st, and relies on  the fact that the weekday whose numeric value is 1 according to AppleScript is also the first day of the weeks you want to count.

--
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:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Date question with weeknumber
      • From: "email@hidden" <email@hidden>
References: 
 >Date question with weeknumber (From: Bert Groeneveld <email@hidden>)
 >Re: Date question with weeknumber (From: email@hidden)

  • Prev by Date: Re: Date question with weeknumber
  • Next by Date: Re: Waiting for a web page to be fully loaded
  • Previous by thread: Re: Date question with weeknumber
  • Next by thread: Re: Date question with weeknumber
  • Index(es):
    • Date
    • Thread