My date column is in following format : "%m/%d H:M:S" There is not mention of year in the data.So how can I read this using strptime function. I have tried strptime(dates,"%m/%d H:M:S") but this is returning NA. Thanks -- View this message in context: http://r.789695.n4.nabble.com/reading-as-date-tp4708431.html Sent from the R help mailing list archive at Nabble.com.
Hi! 10.06.2015, 13:20, khatri wrote:> My date column is in following format : "%m/%d H:M:S" > There is not mention of year in the data.So how can I read this using > strptime function. > I have tried strptime(dates,"%m/%d H:M:S") but this is returning NA. > ThanksHow about: strptime(dates,"%m/%d %H:%M:%S") Some data could also be helpful for testing... HTH, Kimmo
Hi khatri,
strptime("6/20 21:56:32","%m/%d %H:%M:%S")
[1] "2015-06-20 21:56:32 AEST"
You forgot the % signs in the format for H:M:S
Jim
On Wed, Jun 10, 2015 at 8:20 PM, khatri <dheeraj.khatri at abzooba.com>
wrote:> My date column is in following format : "%m/%d H:M:S"
> There is not mention of year in the data.So how can I read this using
> strptime function.
> I have tried strptime(dates,"%m/%d H:M:S") but this is returning
NA.
> Thanks
>
>
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/reading-as-date-tp4708431.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
Hey sorry for my typing. I have actually used the same format with % that is> dd<-c("21/01 11:11:11") > strptime(dd,"%d/%m H:M:S")[1] NA it is giving NA. -- View this message in context: http://r.789695.n4.nabble.com/reading-as-date-tp4708434p4708441.html Sent from the R help mailing list archive at Nabble.com.