A colleague of mine would like to know how seconds since 1970 (represented as integers) can be converted to date-time objects? thanks -- John Bjornar Bremnes Norwegian Meteorological Institute (met.no) Research and Development Department P.O.Box 43 Blindern, N-0313 Oslo, Norway Phone: (+47) 2296 3326. Fax: (+47) 2269 6355
The solution turned out to be simple:> x <- 0:100 > class(x) <- "POSIXct" > xJohn Bjornar John Bjornar Bremnes wrote:> > A colleague of mine would like to know how seconds since 1970 > (represented as integers) can be converted to date-time objects? > > thanks > > -- > John Bjornar Bremnes > Norwegian Meteorological Institute (met.no) > Research and Development Department > P.O.Box 43 Blindern, N-0313 Oslo, Norway > Phone: (+47) 2296 3326. Fax: (+47) 2269 6355 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Mon, 3 Feb 2003, John Bjornar Bremnes wrote:> A colleague of mine would like to know how seconds since 1970 > (represented as integers) can be converted to date-time objects?ISOdate(1970,1,1)+seconds -thomas
On Mon, 3 Feb 2003, John Bjornar Bremnes wrote:> The solution turned out to be simple: > > > x <- 0:100 > > class(x) <- "POSIXct" > > x >Yes, but that relies on the internal representation of POSIXct objects, which is probably unwise. -thomas
On Mon, 3 Feb 2003, John Bjornar Bremnes wrote:> A colleague of mine would like to know how seconds since 1970 > (represented as integers) can be converted to date-time objects?structure(as.double(x), class=c("POSIXt", "POSIXlt")) will do it in the current version. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595