Class representing a date.
See the documentation to the file date.rb for an overview.
Internally, the date is represented as an Astronomical Julian Day Number, ajd. The Day of Calendar Reform, sg, is also stored, for conversions to other date formats. (There is also an of field for a time zone offset, but this is only for the use of the DateTime subclass.)
A new Date object is created using one of the object creation class methods named after the corresponding date format, and the arguments appropriate to that date format; for instance, Date::civil() (aliased to Date::new()) with year, month, and day-of-month, or Date::ordinal() with year and day-of-year. All of these object creation class methods also take the Day of Calendar Reform as an optional argument.
Once a Date has been created, date values can be retrieved for the different date formats supported using instance methods. For instance, #mon() gives the Civil month, #cwday() gives the Commercial day of the week, and #yday() gives the Ordinal day of the year. Date values can be retrieved in any format, regardless of what format was used to create the Date instance.
LD_EPOCH_IN_CJD = 2299160
UNIX_EPOCH_IN_CJD = 2440588
MJD_EPOCH_IN_CJD = 2400001
UNIX_EPOCH_IN_AJD = Rational(4881175, 2)
MJD_EPOCH_IN_AJD = Rational(4800001, 2)
NANOSECONDS_IN_SECOND = Rational(1, 10**9)
MILLISECONDS_IN_SECOND = Rational(1, 10**3)
NANOSECONDS_IN_DAY = Rational(1, 86400*10**9)
MILLISECONDS_IN_DAY = Rational(1, 86400*10**3)
SECONDS_IN_DAY = Rational(1, 86400)
MINUTES_IN_DAY = Rational(1, 1440)
HOURS_IN_DAY = Rational(1, 24)
HALF_DAYS_IN_DAY = Rational(1, 2)
GREGORIAN = -Infinity.new
JULIAN = Infinity.new
ENGLAND = 2361222
ITALY = 2299161
ABBR_DAYNAMES = %w(Sun Mon Tue Wed Thu Fri Sat)
ABBR_MONTHNAMES = [nil] + %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
DAYNAMES = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
MONTHNAMES = [nil] + %w(January February March April May June July August September October November December)
lib/yaml/rubytypes.rb lib/date.rb lib/date/format.rb