OtherDate()
creates an object of class OtherDate
containing day, month, year, and
calendar. This has methods to convert to and from Date
, and will attempt to convert from any other type by coercing to Date
first.
OtherDate(day, month, year, calendar)
as.OtherDate(x,calendar,...)
"as.Date"(x,...)
"as.OtherDate"(x,calendar,...)
"as.OtherDate"(x,calendar,...)
Date
or OtherDate
object as appropriateOtherDate
or Date
as appropriate.
Technically the Islamic calendar depends on actual sighting of the crescent moon and so cannot be projected into the future. In practice, a reliable guide to the calendar has alternating months of 29 and 30 days, with a leap day at the end of year in 11 years out of 30. This is used by the "islamic" converter. The converter has 1-1-1 as 16 July 622CE; some sources use 15 July of that year.
The French Revolutionary calendar is essentially pointless, since it was only used for 14 years and there is a bug it how it was originally defined -- the specifications of having a leap year every fourth year and having the year start on the autumn equinox are incompatible.
date
, as.Date
persian <- OtherDate(day=1:20, month=10, year=1385, calendar="persian")
persian
gregorian<-as.Date(persian)
gregorian
as.OtherDate(gregorian,"persian")
as.OtherDate(gregorian,"islamic")
as.OtherDate(gregorian,"hebrew")
## from POSIXct
as.OtherDate(.leap.seconds, "persian")
## Not run:
# ## from character string in Gregorian date,
# ## (depends on month names in your locale)
# as.OtherDate("14jun1969",format="%d%b%Y", "hebrew")
# ## End(Not run)
Run the code above in your browser using DataLab