Re[2]: Last day of month..
Posted in 1998
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 2. Do a 1. on the result of 1. and you get to the 1st of the next month 3. Subtract 1 day from the result of 2. and you get to the last day of the month of your_date 4. Use the day function gives you the final result. Rudy ______________________________ Reply Separator _________________________________ Subject: Re: Last day of month.. Author: loudelon@cyberbeach.net (Louis DeLongchamp) at Unixgate Date: 22/09/98 2:20 PM >SUNIL S. SINGH wrote: > >Hi All !! > >Is there any function or technique to find last day of month >ie 29 or 28 or 30 or 31 for a particular date(dd/mm/yy) > Here is the function that will do it! The function takes your date and returns the last day ie. 28, 29, 30 or 31. function fn_leap(fndate) define fndate date, j, k smallint let j = month(fndate) if j = 4 or j = 6 or j = 9 or j = 11 then return 30 end if if j <> 2 then return 31 end if let k = year(fndate) if k mod 100 = 0 then if k mod 400 = 0 then return 29 else return 28 end if else if k mod 4 = 0 then return 29 end if end if return 28 end function loudelon...