Re: Need Explanation
Posted in 2003
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Andrew Hamm wrote: > Paul Watson wrote: > >>> let mnth = month(sdate) >>> let yr = year(sdate) >>> # let edatec = mnth using "&&", "/01/", yr using "&&&&" >> >>Give me a full first of the month date based on mnth and yr >> >> >>> let edate = edatec >>> # let edate = extend(edate) + 1 units month - 1 units day >> >>Set edate to the end of the next month > > > But even as a piece of 4GL code, this is a bit clumsy, because it's > depending on the way $DBDATE is set. It would have been much better if the > original author used the MDY function: > > let edatec = MDY(mnth, 1, yr) > let edate = MDY(month + 1, 1, yr) - 1 ... and if you want it to work in December: LET edate = MDY(MONTH(sdate + 1 UNITS MONTH), 1, YEAR(sdate)) - 1 Cheers, -- Mark. +----------------------------------------------------------+-----------+ | Mark D. Stock mailto:mdstock@MydasSolutions.com |//////// /| | Mydas Solutions Ltd http://MydasSolutions.com |///// / //| | +-----------------------------------+//// / ///| | |We value your comments, which have |/// / ////| | |been recorded and automatically |// / /////| | |emailed back to us for our records.|/ ////////| +----------------------+-----------------------------------+-----------+ sending to informix-list
Mark D. Stock wrote: > > ... and if you want it to work in December: > > LET edate = MDY(MONTH(sdate + 1 UNITS MONTH), 1, YEAR(sdate)) - 1 Oh yeah - that's a pisser. Silly me. I guess EXTEND and friends does have it's uses......