The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
shide
is an R package that provides date and date-time support based on Jalali calendar. jdate
and jdatetime
are two simple classes for storing Jalali dates and date-times respectively. These classes are implemented based on the infrastructure provided by the vctrs
package.
You can install shide from CRAN with:
Or you can install the development version from GitHub:
tzdb
package.jdate
and jdatetime
are built upon numeric vectors, just like Date
and POSIXct
. So conversion between date classes (jdate
and Date
) and date-time classes (jdatetime
and POSIXct
) comes at zero cost.jdate
and jdatetime
can be used as column in a data frame.difftime
class. For example, subtraction of two jdate
s results a difftime
object.As with Date
class, a jdate
object can be generated from character and numeric vectors and also from individual components. To parse a character vector that represents Jalali dates, use jdate()
and supply a format string:
library(shide)
jdate("1402-09-13")
#> <jdate[1]>
#> [1] "1402-09-13"
jdate("1402/09/13", format = "%Y/%m/%d")
#> <jdate[1]>
#> [1] "1402-09-13"
Unlike as.Date()
, jdate()
method for numeric inputs does not expose origin
argument.
To create a jdate
from individual components, use jdate_make()
:
Like jdate
a jdatetime
object can be generated from a character or numeric vector or from individual components. But a timezone should be supplied in either case:
jdatetime("1402-09-13 15:37:29", tzone = "")
#> <jdatetime<local>[1]>
#> [1] "1402-09-13 15:37:29"
jdatetime("1402/09/13 15:37:29", tzone = "Asia/Tehran", format = "%Y/%m/%d %H:%M:%S")
#> <jdatetime<Asia/Tehran>[1]>
#> [1] "1402-09-13 15:37:29"
# Jalali date-time that corresponds to Unix epoch
jdatetime(0, tzone ="Asia/Tehran")
#> <jdatetime<Asia/Tehran>[1]>
#> [1] "1348-10-11 03:30:00"
jdatetime_make(1399, 12 ,30, 23, 59, 59, "Asia/Tehran")
#> <jdatetime<Asia/Tehran>[1]>
#> [1] "1399-12-30 23:59:59"
Converting other date and date-time classes to jdate
and jdatetime
is possible with as_jdate()
and as_jdatetime()
respectively:
as_jdate(Sys.Date())
#> <jdate[1]>
#> [1] "1402-12-24"
as_jdatetime(Sys.time())
#> <jdatetime<local>[1]>
#> [1] "1402-12-24 14:43:41"
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.