[R] date and time conversion

Rui Barradas ruipbarradas at sapo.pt
Wed May 2 15:59:06 CEST 2012


Hello,


mpostje wrote
> 
> Hi
> 
> I've been trying to convert numbers from an online temperature database
> into dates and time that R recognizes. the problem is that the database
> has put a T
> between the numbers and R will not accept any conversions. 
> 
> this is the format that it's in now
> 1981-01-02T08:00
> 
> can anyone help?
> cheers!
> 

Try

x <- "1981-01-02T08:00"
x.new <- sub("T", " ", x)
as.POSIXct(x.new)

Hope this helps,

Rui Barradas


--
View this message in context: http://r.789695.n4.nabble.com/date-and-time-conversion-tp4602786p4603288.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list