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:> 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.Is that the number of seconds since 1970-01-01?> x <- 995752800 > class(x) <- c("POSIXt", "POSIXct") > x[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.) -- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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:>
> 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
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
--
Joerg Maeder .:|:||:..:.||.:: maeder at atmos.umnw.ethz.ch
Tel: +41 1 633 36 25 .:|:||:..:.||.::
http://www.iac.ethz.ch/staff/maeder
PhD student at INSTITUTE FOR ATMOSPHERIC AND CLIMATE SCIENCE (IACETH)
ETH Z?RICH Switzerland
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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:
> 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
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._