Hi, is there an R function to convert unixtime to one of the R time formats (using chron or POSIXct)? Example data: unixtime year month day hour 1183377301 2007 7 2 13 I would like to only use the first column. If such a function does not exist: What would be a good input format for R (I could parse the input using AWK or other GNU/Linux tools). TIA, Patrick> version_ platform i486-pc-linux-gnu arch i486 os linux-gnu system i486, linux-gnu status major 2 minor 5.1 year 2007 month 06 day 27 svn rev 42083 language R version.string R version 2.5.1 (2007-06-27)
On Sat, 14 Jul 2007, Patrick Drechsler wrote:> Hi, > > is there an R function to convert unixtime to one of the R time > formats (using chron or POSIXct)? > > Example data: > > unixtime year month day hour > 1183377301 2007 7 2 13 > > I would like to only use the first column.See ?as.POSIXct, especially its examples. (Isn't that the very obvious place to look?) It seems you want ISOdatetime(1970,1,1,0,0,0) + unixtime although depending on the 'unix' in 'unixtime' you might have to wrorry about leap seconds (which POSIX-compliant systems ignore). -- 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
you can try this free online timestamp converter <http://www.online-code.net/unix-timestamp.html> to convert timestamp to readable date. -- View this message in context: http://r.789695.n4.nabble.com/unixtime-conversion-tp829898p4712599.html Sent from the R help mailing list archive at Nabble.com.
you can also do:> structure(1183377301, class = c("POSIXct", "POSIXt"))[1] "2007-07-02 07:55:01 EDT">Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Sep 22, 2015 at 8:01 AM, JonyGreen <JonyGreen at outlook.com> wrote:> you can try this free online timestamp converter > <http://www.online-code.net/unix-timestamp.html> to convert timestamp to > readable date. > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/unixtime-conversion-tp829898p4712599.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. >[[alternative HTML version deleted]]