Page 1 of 1

Date functions

Posted: Tue Mar 24, 2015 12:18 am
by adventuresofgreg
Howdy. I'm just look for a slick way of using dateitems (or something?) to do something like this:

Put x business days prior to the 3rd Wednesday of thismonth

Thanks, I'm having a hard time with this.

Re: Date functions

Posted: Wed Mar 25, 2015 1:39 am
by dunbarx
Greg.

So much fun. But you can do this. If you want to use dateItems, and there is nothing wrong with that, think about this handler:

Code: Select all

on mouseUp
   put "3/31/2015" into tDate
   convert tDate to dateItems
   repeat until item 7 of tDate = 4
      subtract 1 from item 3 of tDate
      convert tDate to dateItems
   end repeat
   answer "Well, the last Wednesday is" && tDate
end mouseUp
Put a breakpoint in the "subtract" line of the repeat loop, and step through. Now what is the next step?

Craig Newman