Skip to content
Prev 240764 / 398500 Next

finding the last day of the month

On Mon, Nov 8, 2010 at 7:06 AM, Benjamin Williams <ben at bwmcct.com> wrote:
There are many ways to do this but here is one using as.yearmon in
zoo.  This converts the Date variable, today, to "yearmon" class which
is a year and a fraction representing a month.  Then it converts it
back to "Date" class using frac = 1 which means all the way to the end
of the month (frac = 0, the default, means 1st of month, etc.):
[1] "2010-11-30"

If you are trying to show monthly data another option might be just to
not show the day at all:
[1] "Nov 2010"
[1] "Nov 2010"