[R] Date operation Question in R

Thomas Petzoldt thpe at simecol.de
Fri Mar 31 00:16:21 CEST 2017


On 30.03.2017 23:34, Paul Bernal wrote:
> Hello everyone,
>
> Is there a way to use the function seq to generate a date sequence in
> this kind of format: jan-2007?

format(seq(ISOdate(2017,1,1), ISOdate(2017,12,31), "months"), "%b-%Y")

>
> Also, is there a way to change the Sys.Date() format to the one
> mentioned above (jan-2007)?

format(Sys.Date(), "%b-%Y")

see ?strptime for details.

Thomas

>
> Thanks in advance for your valuable help,
>
> Best regards,
>
> Paul



More information about the R-help mailing list