as_jdatetime {shide}R Documentation

Cast an object to a jdatetime object

Description

A generic function that converts other date/time classes to jdatetime.

Usage

as_jdatetime(x, tzone, ...)

Arguments

x

a vector of jdate, POSIXct or Date.

tzone

A time zone name.

...

These dots are for future extensions and must be empty.

Details

If tzone is missing (default), time zone attribute of input object is used for conversion. If the input object does not have time zone attribute (e.g. jdate), and no value is supplied for tzone, local time zone is assumed for conversion.

Value

A vector of jdatetime objects with the same length as x.

Examples

## The time will be set to midnight when converting from `jdate` or `Date`
as_jdatetime(jdate_now())
as_jdatetime(Sys.Date())
## We can change time zone of a `jdatetime` to a new time zone
as_jdatetime(jdatetime_now(tzone = "Iran"), tzone = "Asia/Tokyo")

[Package shide version 0.2.1 Index]