On 14/03/11 02:00, Raoni Rosa Rodrigues wrote: > Hello R Help, > > I'm working in a project with a software that register date and time data in > serial time format. This format is used by excel, for exemple. In this > format, 40597.3911423958 is 2011/2/23 09:23:15.
Not on my system, but this should get you going: ( a<- as.POSIXct("2011-02-23 09:23:15.00001", tz="GMT") ) # [1] "2011-02-23 09:23:15 GMT" ( b<- difftime(a, ISOdatetime(1900,1,1,0,0,0), tz="GMT", units="days") ) # Time difference of 40595.39 days as.double(b) # [1] 40595.39 options("digits.secs" = 6) ISOdatetime(1900, 1, 1, 0, 0, 0) + 40597.3911423958*60*60*24 # TZ dependent > [1] "2011-02-25 09:23:14.702997 GMT" Hope this helps a little. Allan > First part is number os days since 1900/1/1, and second part is a fraction > of a day. > > I need to make this transformation in R, and use it to make some algebrian > operations. I found that function 'serialNumber' of package 'cxxPack' > transform a as.data class object in this format, but without time fraction. > But I can't find nothing to do the inverse way, transform serial date format > in a POSIX class, for exemple. > > Since now, thanks for your time and atention. > > All best, > > Raoni > Associate Researcher > Fish Passage Center > UFMG, Brazil. > > > "Fica proibido o uso da palavra liberdade, > > a qual será suprimida dos dicionários > > e do pântano enganoso das bocas. > > A partir deste instante > > a liberdade será algo vivo e transparente > > como um fogo ou um rio, > > e a sua morada será sempre > > o coração do homem." > > (Thiago de Mello) > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > R-help@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. [[alternative HTML version deleted]]
______________________________________________ R-help@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.