Re: Last day of month..
Posted in 1998
Topics: General Discussion
Try this: date(mdy(month(your_date), 1, year(your_date)) +1 units month - 1 units day) Using of date() is essential if you want to get DATE instead DATETIME YEAR TO DAY. -------------- Mike Degtyarev dmv@netinfo-moldova.com > Rudolf Fernandes wrote: > >In SQL, you could use the following > > > >SELECT > > DAY(MDY( MONTH(MDY(MONTH(your_date),1,YEAR(your_date))+32) , 1, > > YEAR(MDY(MONTH(your_date),1,YEAR(your_date))+32) ) - 1) > >FROM systables > >WHERE TABNAME = 'systables'; > > > > > >Explanation : > > > >1. mdy(month(your_date), 1, year(your_date)) + 32 > > always takes you into the next month > > Not if you're on the last day of a month. Then this will take you > forward two months. Also if you're on the 30th of any month besides > July and December, or on the 28th or 29th of January. No, I don't think > this method is going to work. > > June > -- > june_t@hotmail.com > Lost in the wilds of Palo Alto, living on Peanut M&M's > >