Re: Date question with weeknumber
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