Examples for 'lubridate::date'


Get/set date component of a date-time

Aliases: date date<-

Keywords: chron manip methods utilities

### ** Examples

x <- ymd_hms("2012-03-26 23:12:13", tz = "America/New_York")
date(x)
[1] "2012-03-26"
as.Date(x) # by default as.Date assumes you want to know the date in UTC
[1] "2012-03-27"
as.Date(x, tz = "America/New_York")
[1] "2012-03-26"
date(x) <- as.Date("2000-01-02")
x
[1] "2000-01-02 23:12:13 EST"

[Package lubridate version 1.8.0 Index]