Package 'jalcal'

Title: Conversion Between Jalali (Persian or Solar Hijri) and Gregorian Calendar Dates
Description: Jalali, also known as Persian, Solar Hijri and Hijri Shamsi calendar is the official calendar of Iran and Afghanistan. It begins on Nowruz, the March equinox, as determined by astronomical calculation and has years of 365 or 366 days. Adapting the algorithms in <https://jdf.scr.ir/>, this package provides tools for converting the Jalali and Gregorian dates.
Authors: Abdollah Jalilian [aut, cre] (0000-0002-6573-0069), jdf.scr.ir [ctb]
Maintainer: Abdollah Jalilian <[email protected]>
License: GPL (>= 2)
Version: 0.2.0
Built: 2024-11-16 04:18:57 UTC
Source: https://github.com/jalilian/jalcal

Help Index


Convert Gregorian calendar date to Jalali calendar date

Description

Convert Gregorian calendar date to Jalali calendar date

Usage

greg2jal(date)

Arguments

date

An object of class Date specifying Gregorian date

Value

An integer vector consisting of the corresponding Jalali year, month and day

Author(s)

Abdollah Jalilian

Examples

greg2jal(base::Sys.Date())

Convert Gregorian calendar date to Jalali calendar date

Description

Convert Gregorian calendar date to Jalali calendar date

Usage

greg2jal0(year, month, day)

Arguments

year

An integer specifying Gregorian year

month

An integer specifying Gregorian month

day

An integer specifying Gregorian day

Value

An integer vector consisting of the corresponding Jalali year, month and day

Author(s)

Abdollah Jalilian

Examples

greg2jal0(622, 3, 21)
greg2jal0(1983, 9, 8)

Determining whether a given year is leap year

Description

Determining whether a given year is leap year

Usage

isLeap(year, cal = "Gregorian")

Arguments

year

An integer vector specifying given years

cal

A character string specifying the calender type. Only 'Gregorian' and 'Jalali' are implemented

Value

A logical vector of of the same length as year which indicates wheter given years are leap years or not

Author(s)

Abdollah Jalilian

Examples

isLeap(1362, 'Jalali')
isLeap(c(2000, 2100))

Convert Jalali calendar date to Gregorian calendar date

Description

Convert Jalali calendar date to Gregorian calendar date

Usage

jal2greg(year, month, day, asDate = TRUE)

Arguments

year

An integer specifying Jalali year

month

An integer specifying Jalali month

day

An integer specifying Jalali day

asDate

A logical flag indicating whether the output Gregorian date must be in date format

Value

If asDate = TRUE, the default case, an object of the Date class in R, otherwise an integer vector consisting of the Gregorian year, month and day

Author(s)

Abdollah Jalilian

Examples

jal2greg(1, 1, 1)
jal2greg(1362, 6, 17)
jal2greg(1362, 6, 17, asDate=FALSE)