PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Some terms and definitions are based on ISO 8601 and JIS X 0301.
The calendar date is a particular day of a calendar year, identified by its ordinal number within a calendar month within that year.
The ordinal date is a particular day of a calendar year identified by its ordinal number within the year.
The week date is a date identified by calendar week and day numbers.
The calendar week is a seven day period within a calendar year, starting on a Monday and identified by its ordinal number within the year; the first calendar week of the year is the one that includes the first Thursday of that year. In the Gregorian calendar, this is equivalent to the week which includes January 4.
The Julian day number is in elapsed days since noon (Greenwich mean time) on January 1, 4713 BCE (in the Julian calendar).
In this document, the astronomical Julian day number is same as the original Julian day number. And the chronological Julian day number is a variation of the Julian day number. Its days begin at midnight on local time.
In this document, when the term "Julian day number" simply appears, it just refers to "chronological Julian day number", not the original.
The modified Julian day number is in elapsed days since midnight (Coordinated universal time) on November 17, 1858 CE (in the Gregorian calendar).
In this document, the astronomical modified Julian day number is same as the original modified Julian day number. And the chronological modified Julian day number is a variation of the modified Julian day number. Its days begin at midnight on local time.
In this document, when the term "modified Julian day number" simply appears, it just refers to "chronological modified Julian day number", not the original.
Object
Comparable
Creates a date object denoting the given calendar date.
In this class, BCE years are counted astronomically. Thus, the year before the year 1 is the year zero, and the year preceding the year zero is the year -1. The month and the day of month should be a negative or a positive number (reverse order when negative). They should not be zero.
The last argument should be a Julian day number which denotes the first day of the Gregorian calendar. You can also give true which mean the proleptic Gregorian calendar, and false which mean the proleptic Julian calendar. Default is Date::ITALY (October 15, 1582).
See also jd.
Creates a date object denoting the given week date.
The week and the day of week should be a negative or a positive number (reverse order when negative). They should not be zero.
This method does not accept dates before the day of calendar reform.
See also jd and new.
Creates a date object denoting the given Julian day number.
In this class, some important methods do not accept negative Julian day numbers.
See also new.
Creates a date object denoting the given ordinal date.
The day of year should be a negative or a positive number (reverse order when negative). It should not be zero.
See also jd and new.
Parses the given representation of dates and times, and creates a date object.
If the optional second argument is true and the detected year is in the range 0 to 99, considers the year a 2-digit form and makes it full. Default is false.
_parse is also available. This method is similar to parse, but returns a hash which contain detected elements, not creates a date object.
Parses the given representation of dates and times with the given template, and creates a date object.
_strptime is also available. This method is similar to strptime, but returns a hash which contain detected elements, not creates a date object.
See also strptime(3) and strftime.
Creates a date object denoting the present day.
Returns a Julian day number if the given calendar date is valid, and nil if not.
See also jd and civil.
Returns a Julian day number if the given week date is valid, and nil if not.
See also jd and commercial.
Just returns the first argument immediately.
It's nonsense, but is for symmetry.
See also jd.
Returns a Julian day number if the given ordinal date is valid, and nil if not.
See also jd and ordinal.
Returns a date object pointing n days after self. The n should be a numeric value.
Returns the difference between the two dates if the x is a date object. If the x is a numeric value, it returns a date object pointing x days before self.
Returns a date object pointing n months before self. The n should be a numeric value.
Compares the two dates and returns -1, zero or 1. The other should be a date object or a numeric value as an astronomical Julian day number.
Returns true if they are the same day.
Returns a date object pointing n months after self. The n should be a numeric value.
Returns a string in asctime(3) format (but without "\n\0" at the end).
Returns the day of calendar week (1-7, Monday is 1).
Returns the calendar week number (1-53).
Returns the calendar week based year.
This method is equivalent to step(min, -1){|date| ...}
.
This method is equivalent to new_start(Date::ENGLAND)
.
This method is equivalent to new_start(Date::GREGORIAN)
.
This method is equivalent to new_start(Date::ITALY)
.
Returns the Julian day number. It has no time of the day.
rjd is also available. This method is similar to jd, but returns the astronomical Julian day number. It may have time of the day.
This method is equivalent to new_start(Date::JULIAN)
.
Returns true if the year is a leap year.
Returns the day of month (1-31).
Returns the modified Julian day number. It has no time of the day.
rmjd is also available. This method is similar to mjd, but returns the astronomical modified Julian day number. It may have time of the day.
Returns the month (1-12).
Duplicates self and resets the its first day of the Gregorian calendar. Default is Date::ITALY (October 15, 1582).
See also new.
Returns a Julian day number denoting the first day of the Gregorian calendar.
See also new.
Iterates evaluation of the given block, which takes a date object. The limit should be a date object, and the step should be a nonzero value.
Formats the date with the given template. The following conversion specifications are supported:
%A, %a, %B, %b, %C, %c, %D, %d, %e, %F, %G, %g, %H, %h, %I, %j, %k, %l, %M, %m, %n, %P, %p, %R, %r, %S, %s, %T, %t, %U, %u, %V, %v, %W, %w, %X, %x, %Y, %y, %Z, %z, %%, %+
See also strftime(3) and strptime.
Returns a date object denoting the following day.
Returns a string in an ISO 8601 format (This method doesn't use the expanded representations).
This method is equivalent to step(max, 1){|date| ...}
.
Returns the day of week (0-6, Sunday is zero).
Returns the day of year (1-366).
Returns the year.
Date
Creates a date-time object denoting the given calendar date.
Creates a date-time object denoting the given week date.
Creates a date-time object denoting the given Julian day number.
Creates a date-time object denoting the present time.
Creates a date-time object denoting the given ordinal date.
Returns the hour (0-23).
Returns the minute (0-59).
Duplicates self and resets the its offset. Default is zero (UTC).
See also new.
Returns the offset.
Returns the second (0-59).
Returns the timezone.
Returns a date object denoting the Easter sunday in the given Gregorian year.
Returns a date object denoting the Easter sunday in the given Julian year.
Returns a date object denoting the given Nth (-5 to 5, except zero) Kday (0-6) in the given month of year.
Returns true if the day is an Easter sunday.
Returns true if the day is a Japanese national holiday.
Returns true if the day is an Nth (-5 to 5, except zero) Kday (0-6).
Returns true if the day is an old Japanese national holiday. This is still experimental.
Parses the given representation of dates and times, and returns an array which contain detected elements (year, month, day of month, hour, minute, second, timezone and day of week).
If the optional second argument is true and the detected year is in the range 0 to 99, considers the year a 2-digit form and makes it full. Default is false.
See also Date::parse.