[R] Converting from "date strings" to internal POSIX format?

Derek Eder derek.eder at lungall.gu.se
Thu Sep 3 19:17:39 CEST 2009


I need to convert a date-style string:  "2009-06-16 09:28:17.746"
To its POSIX representation: 1245137297746


The function below converts my POSIX date to a string ... now I need to go backwards!


render.t32 <- function(t32, tz = "CET")
  {
   timez <- ISOdatetime(1970,1,1,0,0,0, tz ="UTC")+t32/1000
   return(format(timez,"%Y-%m-%d %H:%M:%OS3",tz="CET"))
  }


> render.t32(1245137297746)
[1] "2009-06-16 09:28:17.746"


Have not succeeded in my attempts to understand POSIX
and I thank you for your attention.

~Derek


Derek N. Eder
Gothenburg University
Vigilance and Neurocognition Laboratory
Medicinaregatan 8B
Box 421
Gothenburg Sweden
SE 405 30

tlf (031) 342-8261
mobil 0704 915 714
 
"The most dangerous thing in the jungle is not the snakes, the spiders, the tigers, ...
The most dangerous thing in the jungle is your mind!"




More information about the R-help mailing list