• 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: "email@hidden" <email@hidden>
  • Date: Fri, 23 Apr 2010 10:44:04 -0700


On Apr 23, 2010, at 10:07am, Mark J. Reed wrote:

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


 
Whoops, here's a better version, that actually works.

set weekCount to 10
set startDate to (current date)
set month of startDate to 1
set day of startDate to 1
if startDate + (weekCount * weeks) < (current date) then
set year of startDate to ((year of startDate) + 1)
end if
set calculatedDate to startDate + (weekCount * weeks)
set toWed to 4 - (weekday of calculatedDate as integer)
set WedDate to calculatedDate + (toWed * days)
set tueDate to WedDate + (6 * days)
return {WedDate, tueDate}

I'm thinking about a simple way to calculate the weeks based on the standards you mentioned, which would have to be done for the current year, and the next year, but I like the multipurpose handler in your version.

ES
 _______________________________________________
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

References: 
 >Date question with weeknumber (From: Bert Groeneveld <email@hidden>)
 >Re: Date question with weeknumber (From: email@hidden)
 >Re: Date question with weeknumber (From: "Mark J. Reed" <email@hidden>)

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