Monday, March 12, 2012

Last Day of Current Month

Does anyone have a simpler method for this ?
I want to get the last Day of the Current Month, so my thinking is to take
one day away from the first day of next month...it works but is perhaps not
very elegant.
=cdate(format(DATEADD("d",-1,cdate("01/" &
format(System.DateTime.Now.AddMonths(1),"MM/yyyy"))),"dd/MM/yyyy"))
--
Mike StephenHi Mike,
This is the simplest thing I can think of.
=dateadd("d",-1,str(val(Mid(datestring(),1,2))+1) + "/01/" +
right(datestring(),4))
Amarnath
"Mike Stephen" wrote:
> Does anyone have a simpler method for this ?
> I want to get the last Day of the Current Month, so my thinking is to take
> one day away from the first day of next month...it works but is perhaps not
> very elegant.
> =cdate(format(DATEADD("d",-1,cdate("01/" &
> format(System.DateTime.Now.AddMonths(1),"MM/yyyy"))),"dd/MM/yyyy"))
> --
> Mike Stephen|||That's great. Thank you.
Mike.
--
Mike Stephen
"Amarnath" wrote:
> Hi Mike,
> This is the simplest thing I can think of.
> =dateadd("d",-1,str(val(Mid(datestring(),1,2))+1) + "/01/" +
> right(datestring(),4))
> Amarnath
>
> "Mike Stephen" wrote:
> > Does anyone have a simpler method for this ?
> >
> > I want to get the last Day of the Current Month, so my thinking is to take
> > one day away from the first day of next month...it works but is perhaps not
> > very elegant.
> >
> > =cdate(format(DATEADD("d",-1,cdate("01/" &
> > format(System.DateTime.Now.AddMonths(1),"MM/yyyy"))),"dd/MM/yyyy"))
> > --
> > Mike Stephen

No comments:

Post a Comment