I have some time data and which is in seconds time <-c( 126230400 126252000 126273600 126295200 126316800 126338400) now I wanted to convert this time to Y M D H M S format I have tried following codes but it does not give me the out put in Y M D H M S time_t1 <- as.POSIXlt(time, origin="2005-01-01", tz="GMT") & time_f <- as.POSIXct(time, origin="2005-01-01", tz="GMT") So somebody could please tell me how to fix this problem. Thanks -- View this message in context: http://r.789695.n4.nabble.com/time-conversion-from-second-to-Y-M-D-H-M-S-format-tp4350831p4350831.html Sent from the R help mailing list archive at Nabble.com.
On 02.02.2012 09:26, uday wrote:> > I have some time data and which is in seconds > > time<-c( 126230400 126252000 126273600 126295200 126316800 126338400) > now I wanted to convert this time to Y M D H M S format > > I have tried following codes but it does not give me the out put in Y M D > H M S > > time_t1<- as.POSIXlt(time, origin="2005-01-01", tz="GMT") > & > time_f<- as.POSIXct(time, origin="2005-01-01", tz="GMT") > > So somebody could please tell me how to fix this problem.format(time_t1, "%Y %m %d %H %M %S") Uwe Ligges> > Thanks > > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/time-conversion-from-second-to-Y-M-D-H-M-S-format-tp4350831p4350831.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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.
Dear Uwe , Thanks for reply I have tried format function that u suggested (format(time_t1, "%Y %m %d %H %M %S") and I got format(time_t1, "%Y %m %d %H %M %S") [1] "126230400" "126252000" "126273600" "126295200" "126316800" "126338400" I think something is not working correct. -- View this message in context: http://r.789695.n4.nabble.com/time-conversion-from-second-to-Y-M-D-H-M-S-format-tp4350831p4352062.html Sent from the R help mailing list archive at Nabble.com.