[R] Month Difference

PIKAL Petr petr.pikal at precheza.cz
Fri Sep 7 12:11:48 CEST 2012


One possibility

as.numeric(format(b, "%m"))-as.numeric(format(a, "%m"))

Regards
Petr

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Rantony
> Sent: Friday, September 07, 2012 10:26 AM
> To: r-help at r-project.org
> Subject: [R] Month Difference
> 
> Hi,
> 
> i need a small help.
> 
> a<- as.Date("2012-01-01")
> b<- as.Date("2012-12-01")
> ------------------------------------
> My requirement what is, i need to get the month difference of these two
> dates.
> Can any one help me please !
> - Antony
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Month-
> Difference-tp4642483.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list