Is there any easy way for getting start date and end date of previous month from the current date in R?
I have only the current date. From it, i want to get the prev
You can use the library lubridate, which is very good at doing date arithmetic.
library(lubridate)
currentDate <-Sys.Date()
# end of previous month:
eopm <- currentDate - days(day(currentDate))
# [1] "2012-10-31"
# start of previous month:
sopm <- currentDate - days(day(currentDate))
sopm <- sopm - days(day(sopm) - 1)
# [1] "2012-10-01"