Learn R Programming

shide (version 0.2.1)

jdate_make: Construct Jalali date-time objects from individual components

Description

  • jdate_make() creates a jdate object from individual components.

  • jdatetime_make() creates a jdatetime object from individual components.

Usage

jdate_make(year, month = 1L, day = 1L, ...)

jdatetime_make( year, month = 1L, day = 1L, hour = 0L, minute = 0L, second = 0L, tzone = "", ..., ambiguous = NULL )

Value

  • jdate_make() A vector of jdate object.

  • jdatetime_make() A vector of jdatetime object.

Arguments

year

Numeric year.

month

Numeric month.

day

Numeric day.

...

These dots are for future extensions and must be empty.

hour

Numeric hour.

minute

Numeric minute.

second

Numeric second.

tzone

A time zone name. Default value represents local time zone.

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:

  • "earliest": Choose the earliest of the two moments.

  • "latest": Choose the latest of the two moments.

  • "NA": Produce NA.

If NULL, defaults to "earliest"; as this seems to be base R's behavior.

Details

Numeric components are recycled to their common size using tidyverse recycling rules.

Examples

Run this code
## At least 'year' must be supplied
jdate_make(year = 1401)
## Components are recycled
jdatetime_make(year = 1399:1400, month = 12, day = c(30, 29), hour = 12, tzone = "UTC")
## resolve ambiguous time by choosing the later time instant
jdatetime_make(1401, 6, 30, 23, 0, 0, tzone = "Asia/Tehran", ambiguous = "latest")

Run the code above in your browser using DataLab