date

0th

Percentile

Get/set date component of a date-time

Date-time must be a POSIXct, POSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, and fts objects.

Keywords
manip, methods, utilities, chron
Usage
date(x)

date(x) <- value

Arguments
x

a date-time object

value

an object for which the date() function is defined

Details

date() does not yet support years before 0 C.E. Also date() is not defined for Period objects.

Value

the date of x as a Date

Aliases
  • date
  • date<-
Examples
# NOT RUN {
x <- ymd_hms("2012-03-26 23:12:13", tz = "America/New_York")
date(x)
as.Date(x) # by default as.Date assumes you want to know the date in UTC
as.Date(x, tz = "America/New_York")
date(x) <- as.Date("2000-01-02")
x
# }
Documentation reproduced from package lubridate, version 1.7.4, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.