jdatetime {shide} | R Documentation |
Date-time based on the Jalali calendar
Description
jdatetime
is an S3 class for representing date-times with the Jalali calendar dates.
It can be constructed from character and numeric vectors.
Usage
jdatetime(x, tzone = "", ...)
## S3 method for class 'character'
jdatetime(x, tzone = "", format = NULL, ..., ambiguous = NULL)
Arguments
x |
A vector of numeric or character objects. |
tzone |
A time zone name. Default value represents local time zone. |
... |
Arguments passed on to further methods. |
format |
Format argument for character method. |
ambiguous |
Resolve ambiguous times that occur during a repeated interval (when the clock is adjusted backwards during the transition from DST to standard time). Possible values are:
If |
Details
jdatetime
is stored internally as a double vector and has a single
attribute: the timezone (tzone). Its value represents the count of seconds
since the Unix epoch (a negative value if it represents an instant prior to the epoch).
This implementation coincides with that of POSIXct
class, except that POSIXct
may not have tzone
attribute. But for jdatetime
, tzone
is not optional.
Value
A vector of jdatetime
objects.
Examples
## default time zone and format
jdatetime("1402-09-20 18:57:09")
jdatetime("1402/09/20 18:57:09", tzone = "UTC", format = "%Y/%m/%d %H:%M:%S")
## Will replace invalid format with NA
jdatetime("1402/09/20 18:57:09", format = "%Y-%m-%d %H:%M:%S")
## nonexistent time will be replaced with NA
jdatetime("1401-01-02 00:30:00", tzone = "Asia/Tehran")
## ambiguous time will be replaced with NA
jdatetime("1401-06-30 23:30:00", tzone = "Asia/Tehran", ambiguous = "NA")
## ambiguous time will resolve by choosing the later time instant
jdatetime("1401-06-30 23:30:00", tzone = "Asia/Tehran", ambiguous = "latest")
## Jalali date-time in Iran time zone, corresponding to Unix epoch
jdatetime(0, "Iran")