[R] time conversions

Rui Barradas ruipbarradas at sapo.pt
Wed Feb 18 20:26:19 CET 2015


Hello,

Try

as.POSIXlt(1043107680, origin = "1970-01-01", tz = "CET")


Hope this helps,

Rui Barradas

Em 18-02-2015 17:45, Troels Ring escreveu:
> dear friends - sorry to ask another simple question -
> I have dates set up as this:
> dates  #[1] 2003-01-21 01:08:00
>
> To handle it I did
> as.POSIXlt(dates)  "2003-01-21 01:08:00 CET"
>
> but noticed that during write.table it was apparently better to take it
> further
> as.numeric(as.POSIXct(as.POSIXlt(dates))   1043107680
>
> And this works fine for modeling but now I would like to have it back as
> POSIXlt
> as.POSIXlt requires an origin, if I'm right.
> So how is it done?
>
> Best wishes
>
> Troels Ring
> Aalborg
> Denmark
>
> ______________________________________________
> 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.



More information about the R-help mailing list