Dear R Help,

I am trying to get fields showing the last day of each month for a monthly
closing project.  In order to find the last day of the previous month, I
subtract the number of days from the current month. For all months my code
works; however, for October, my code doesn't work...it returns
2010-09-*29* instead
of 2010-09-*30*.

format(strptime("2010-10-31",
"%Y-%m-%d")-(as.numeric(format(as.Date("2010-10-31"),"%d"))*24*3600),"%Y-%m-%d")

I appreciate any suggestions or tips.

Thank you.
Ben

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to