as.Date.date_xx {dint}R Documentation

Coerce dint Objects to Base R Date Types

Description

All dint objects can be coerced to base R Date or Datetime (POSIXct) types. The resulting date will always default to the first possible Date/Datetime in this period.

Usage

## S3 method for class 'date_xx'
as.POSIXlt(x, tz = "", ...)

## S3 method for class 'date_xx'
as.POSIXct(x, tz = "", ...)

Sys.date_yq()

Sys.date_ym()

Sys.date_yw()

## S3 method for class 'date_y'
as.Date(x, ...)

## S3 method for class 'date_ym'
as.Date(x, ...)

## S3 method for class 'date_yq'
as.Date(x, ...)

## S3 method for class 'date_yw'
as.Date(x, ...)

Arguments

x

any R object

tz

time zone specification to be used for the conversion, if one is required. System-specific (see time zones), but "" is the current time zone, and "GMT" is UTC (Universal Time, Coordinated). Invalid values are most commonly treated as UTC, on some platforms with a warning.

...

passed on to methods

Details

If lubridate is loaded, methods for lubridate generics (such as lubridate::month() and lubridate::year()) are also made available by dint.

Value

An Object of the appropriate base R type (Date, POSIXct, or POSIXlt)

Examples

as.Date(date_yq(2017, 2))
as.POSIXlt(date_yq(2017, 2))

# When coercing to datetime, the default timezone is UTC
as.POSIXct(date_yq(2017, 2))

[Package dint version 2.1.3 Index]