[R] Problem with Dates

Kurt Hornik Kurt.Hornik at ci.tuwien.ac.at
Wed Feb 23 12:32:17 CET 2000


>>>>> Richard A Bilonick writes:

> Hi,

> My dates are printing as 01/01/100 instead of 01/01/2000. I can't find
> a way to get mm/dd/yyyy type format. I've tried using
> out.format="mm/dd/yyyy" but it writes out the month name (and that is
> all). I've installed both chron and date. The version of R is 0.65.1.

Chron does not support mm/dd/yyyy etc formats.  I am planning to add
improved full-year formatting capabilities to chron eventually, but this
may take some time.  Meanwhile, you can always use

	out.format = "mon day year"

(which will use spaces as separators), or try writing your own format.

One quick hack for output formatting:

mdY <- function(x) {
    out <- month.day.year(x)
    paste(formatC(out$m, width = 2, flag = "0"),
          formatC(out$d, width = 2, flag = "0"),
          out$y,
          sep = "/")
}

R> x <- chron(15000, out.format = mdY)
R> x
[1] 01/26/2011

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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