Learn R Programming

datetimeoffset (version 1.0.0)

as_datetimeoffset: Coerce to "datetimeoffset" objects

Description

as_datetimeoffset() coerces to datetimeoffset() objects.

Usage

as_datetimeoffset(x, ...)

# S3 method for datetimeoffset as_datetimeoffset(x, ...)

# S3 method for Date as_datetimeoffset(x, tz = NA_character_, ...)

# S3 method for default as_datetimeoffset(x, ...)

# S3 method for integer as_datetimeoffset(x, ...)

# S3 method for numeric as_datetimeoffset(x, ...)

# S3 method for POSIXt as_datetimeoffset(x, ...)

# S3 method for character as_datetimeoffset(x, tz = NA_character_, ...)

# S3 method for nanotime as_datetimeoffset(x, tz = "GMT", ...)

# S3 method for partial_time as_datetimeoffset(x, ...)

# S3 method for clock_year_month_day as_datetimeoffset(x, ...)

# S3 method for clock_year_month_weekday as_datetimeoffset(x, ...)

# S3 method for clock_iso_year_week_day as_datetimeoffset(x, ...)

# S3 method for clock_year_quarter_day as_datetimeoffset(x, ...)

# S3 method for clock_year_day as_datetimeoffset(x, ...)

# S3 method for clock_naive_time as_datetimeoffset(x, ...)

# S3 method for clock_sys_time as_datetimeoffset(x, ...)

# S3 method for clock_zoned_time as_datetimeoffset(x, ...)

Value

A datetimeoffset() vector

Arguments

x

An R object that can reasonably be coerced to a datetimeoffset() object such as a string in pdfmark date or ISO 8601 datetime formats or something with an as.POSIXct() method.

...

Further arguments to certain methods.

tz

Time zone to use for the conversion. Ignored by as_datetimeoffset.Date(). Generally need not be a single value.

Examples

Run this code
# ISO 8601 examples
as_datetimeoffset("2020-05-15")
as_datetimeoffset("20200515")
as_datetimeoffset("2020-05-15T08:23:16")
as_datetimeoffset("20200515T082316")
as_datetimeoffset("2020-05-15T08:23:16.003Z")
as_datetimeoffset("20200515T082316Z")
as_datetimeoffset("2020-05-15T08:23:16+03:30")
as_datetimeoffset("20200515T082316+0330")

# Misc supported `as.POSIXlt()` `tryFormats` examples
as_datetimeoffset("2020/05/15 08:23:16")

# pdfmark datetime examples
as_datetimeoffset("D:20200515")
as_datetimeoffset("D:20200515082316")
as_datetimeoffset("D:20200515082316+03'30'")

as_datetimeoffset(Sys.time())

Run the code above in your browser using DataLab