Last Day Function
Posted in 2006
Topics: General Discussion
Hi, I'm have a problem, I would like know how return a last day of the month in db Informix . Thank you. leandro@logus-consultoria.com.br. -- leandro_logus ------------------------------------------------------------------------ leandro_logus's Profile: http://www.dbtalk.net/m544 View this thread: http://www.dbtalk.net/t319978
At the Tampa conference 2006, June Hunt did a session on dates with Informix. Very good presentation! It can be found @ www.iiug.org. FYI leandro_logus wrote: > Hi, I'm have a problem, I would like know how return a last day of the > month in db Informix . > > Thank you. > leandro@logus-consultoria.com.br. > > > -- > leandro_logus > ------------------------------------------------------------------------ > leandro_logus's Profile: http://www.dbtalk.net/m544 > View this thread: http://www.dbtalk.net/t319978
leandro_logus wrote: > Hi, I'm have a problem, I would like know how return a last day of the > month in db Informix . > Make a date, using MDY, as the first day of the next month and take one away. -- rh
> leandro_logus wrote:
> > Hi, I'm have a problem, I would like know how return a last day of the
> > month in db Informix .
> >
Try this
-----------------------------------------------------------------------------------------
create procedure lastDayOfMonth(dt date) returning date; return extend(extend(dt+1 units month,year to month)||"-01"
,year to day) - 1 units day;
end procedure;
execute procedure lastDayOfMonth(today);-----------------------------------------------------------------------------------------
Eric Lam
eric.lam@cobrasonic.com
Hi Leandro; Consider, the last day of a month is the the first day of the following month - 1 day. On 18 Jul 2006 at 12:54, leandro_logus wrote: > > Hi, Im have a problem, I would like know how return a last day of the > month in db Informix . > > Thank you. > leandro@logus-consultoria.com.br. > > > -- > leandro_logus > ------------------------------------------------------------------------ > leandro_logus's Profile: http://www.dbtalk.net/m544 > View this thread: http://www.dbtalk.net/t319978 > >