date - How to Convert and Search through Time Strings in R? -
i have date/time given strings of form "2012-12-11 10:01:37 -0800". i'm wondering how convert date/time value, , if there way sort df year or month. thank you!
just need use as.posixct() convert string posixct class , can manipulate form of time like.
> as.posixct("2012-12-11 10:01:37 -0800") [1] "2012-12-11 10:01:37 est" > month(as.posixct("2012-12-11 10:01:37 -0800")) [1] 12 > day(as.posixct("2012-12-11 10:01:37 -0800")) [1] 11 > year(as.posixct("2012-12-11 10:01:37 -0800")) [1] 2012
Comments
Post a Comment