Learn R Programming

shide (version 0.2.1)

jdate: Jalali calendar dates

Description

jdate is an S3 class for representing the Jalali calendar dates. It can be constructed from character and numeric vectors.

Usage

jdate(x, ...)

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

# S3 method for character jdate(x, format = NULL, ...)

Value

A vector of jdate objects.

Arguments

x

A vector of numeric or character objects.

...

Arguments passed on to further methods.

format

Format argument for character method.

Details

jdate is stored internaly as a double vector and doesn't have any attributes. Its value represents the count of days since the Unix epoch (a negative value if it represents a date prior to the epoch). This implementation coincides with the implementation of Date class.

Examples

Run this code
jdate("1402-09-20")
jdate("1402/09/20", format = "%Y/%m/%d")
## Will replace invalid date format with NA
jdate("1402/09/20", format = "%Y-%m-%d")
## Invalid dates will be replaced with NA
jdate("1402-12-30")
## Jalali date corresponding to "1970-01-01"
jdate(0)

Run the code above in your browser using DataLab