[R] conversion of time

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 2 21:13:07 CEST 2001


On Thu, 2 Aug 2001, Claudia Tebaldi wrote:

> Hi
>
> I have integer values representing unix time, stored into a  simple
> numeric vector, no POSIX* class inheritance of any kind. Something like
>
> crazylookingtimes_c(993340800.00, 993254400.00, 994809600.00)
>
> I'd like to convert them into a format like YYDDMMHHMMSS but I cannot find
> out how, at least not in the documentation on DateTimeClasses that I've
> skimmed.

Is

crazylookingtimes <- c(993340800.00, 993254400.00, 994809600.00)
class(crazylookingtimes) <- "POSIXct"
[1] "2001-06-24 01:00:00 BST" "2001-06-23 01:00:00 BST"
[3] "2001-07-11 01:00:00 BST"

what you wanted (probably not in that time zone)? Or

format(crazylookingtimes, "%y%d%m%H%M%S")
[1] "012406010000" "012306010000" "011107010000"

if you really want an illogical format like YYDDMMHHMMSS ....

See our article in the latest Rnews for more background details.
It would be pretty unusula to have raw Unix 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list