Skip to content

a R question

4 messages · Jesús Fernández Gálvez, Brian Ripley, Joerg Maeder +1 more

#
Dear Sir,

I have been working with R  for some time now and I am very happy with
it, but I have found a problem that I could not resolve. Could you
please give me some hint about how to transform  POSIX time data in
seconds to  string  format?. (eg. 995752800 -> year-month,day,hour,min,
sec) I tryed with Sys.time(), strptime() and date() but without success.

Thank you very much in advance

Jesus Fernandez
Estacion Experimental del  Zaidin
Granada, Spain



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Wed, 20 Mar 2002, [iso-8859-1] Jesús Fernández Gálvez wrote:

            
Is that the number of seconds since 1970-01-01?
[1] "2001-07-21 23:00:00 GMT Daylight Time"

in my locale.  Use format on `x' to get the format you want.

(This is deliberately not made easy by as.POSIXct, as there is no
way to check the numbers are indeed POSIX times.)
#
Hello Jes?s,

The numeric value is the differnece since 1970 1.Jan at one a clock in
th morning
you can see that with 
Sys.time()-as.numeric(Sys.time())

This information ypu can use to transform your numeric value
strptime("1970-01-01 01:00:00 MET",format='%Y-%m-%d %H:%M:%S
%Z')+995752800

gruess

jeorg
Jes?s Fern?ndez G?lvez wrote:

  
    
#
Add the base date to your number and then
use format to format it:

z <- 995752800
time0 <- as.POSIXct("1970-01-01", tz="GMT")
format(z+time0,"%Y-%m,%d,%H,%M,%S")
On 20 Mar 2002 at 12:18, Jes?s Fern?ndez G?lvez wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._