I've got a problem when creating some dynamic date objects.
library(lubridate)
day <- as.Date(Sys.time())
this_m <- format(day,"%m")
next_m <- format(day + months(1), "%m")
m_after <- format(day + months(2), "%m")
For some reason the next_m object delivers an object that is considered 'chr NA' while the m_after object delivers the correct value (as of today, a character object of "03"). Previously the next_m object has delivered the intended result, however today it's giving the result described above. This is very strange given that m_after works fine. Does anyone know how I can fix this? Any help is greatly appreciated.
I need create an object that has the numeric version of the month in two digits, e.g March is 03 rather than just 3