Date functions

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Date functions

Post by adventuresofgreg » Tue Mar 24, 2015 12:18 am

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Date functions

Post by dunbarx » Wed Mar 25, 2015 1:39 am

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

Post Reply