The R Project SVN R

Rev

Rev 85953 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 85953 Rev 86130
Line 1... Line 1...
1
% File src/library/base/man/as.Date.Rd
1
% File src/library/base/man/as.Date.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 1995-2022 R Core Team
3
% Copyright 1995-2024 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{as.Date}
6
\name{as.Date}
7
\alias{format.Date}
7
\alias{format.Date}
8
\alias{as.character.Date}
8
\alias{as.character.Date}
Line 26... Line 26...
26
\method{as.Date}{character}(x, format, tryFormats = c("\%Y-\%m-\%d", "\%Y/\%m/\%d"),
26
\method{as.Date}{character}(x, format, tryFormats = c("\%Y-\%m-\%d", "\%Y/\%m/\%d"),
27
        optional = FALSE, \dots)
27
        optional = FALSE, \dots)
28
\method{as.Date}{numeric}(x, origin, \dots)
28
\method{as.Date}{numeric}(x, origin, \dots)
29
\method{as.Date}{POSIXct}(x, tz = "UTC", \dots)
29
\method{as.Date}{POSIXct}(x, tz = "UTC", \dots)
30
 
30
 
31
\method{format}{Date}(x, \dots)
31
\method{format}{Date}(x, format = "\%Y-\%m-\%d", \dots)
32
 
32
 
33
\method{as.character}{Date}(x, \dots)
33
\method{as.character}{Date}(x, \dots)
34
}
34
}
35
\arguments{
35
\arguments{
36
  \item{x}{an object to be converted.}
36
  \item{x}{an object to be converted.}
37
  \item{format}{\code{\link{character}} string.  If not specified, it will try
37
  \item{format}{a \code{\link{character}} string.  If not specified when
-
 
38
    converting from a character representation, it will try
38
    \code{tryFormats} one by one on the first non-\code{NA} element, and
39
    \code{tryFormats} one by one on the first non-\code{NA} element, and
39
    give an error if none works.  Otherwise, the processing is via
40
    give an error if none works.  Otherwise, the processing is via
40
    \code{\link{strptime}()} whose help page describes available
41
    \code{\link{strptime}()} whose help page describes available
41
    conversion specifications.}
42
    conversion specifications.}
42
  \item{tryFormats}{\code{\link{character}} vector of \code{format}
43
  \item{tryFormats}{\code{\link{character}} vector of \code{format}
Line 45... Line 46...
45
    (instead of signalling an error) if the format guessing does not succeed.}
46
    (instead of signalling an error) if the format guessing does not succeed.}
46
  \item{origin}{a \code{Date} object, or something which can be coerced by
47
  \item{origin}{a \code{Date} object, or something which can be coerced by
47
    \code{as.Date(origin, \dots)} to such an object or
48
    \code{as.Date(origin, \dots)} to such an object or
48
    \code{\link{missing}}.  In that case, \code{"1970-01-01"} is used.}
49
    \code{\link{missing}}.  In that case, \code{"1970-01-01"} is used.}
49
  \item{tz}{a time zone name.}
50
  \item{tz}{a time zone name.}
50
  \item{\dots}{further arguments to be passed from or to other methods,
51
  \item{\dots}{further arguments to be passed from or to other methods.}
51
    including \code{format} for \code{as.character} and \code{as.Date}
-
 
52
    methods.}
-
 
53
}
52
}
54
\details{
53
\details{
55
  The usual vector re-cycling rules are applied to \code{x} and
54
  The usual vector re-cycling rules are applied to \code{x} and
56
  \code{format} so the answer will be of length that of the longer of the
55
  \code{format} so the answer will be of length that of the longer of the
57
  vectors.
56
  vectors.