[R] Month Difference

Akkara, Antony (GE Energy, Non-GE) Antony.Akkara at ge.com
Fri Sep 7 12:20:32 CEST 2012


Yes. Its working fine. We need to convert to "as.Date" thatz all.
Thank you Petr.

-----Original Message-----
From: PIKAL Petr [mailto:petr.pikal at precheza.cz] 
Sent: Friday, September 07, 2012 3:42 PM
To: Akkara, Antony (GE Energy, Non-GE); r-help at r-project.org
Subject: RE: [R] Month Difference

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