Bug #13193 ยป doc_date_datetime.patch
ext/date/date_core.c | ||
---|---|---|
*
|
||
* Date.valid_jd?(2451944) #=> true
|
||
*
|
||
* See also jd.
|
||
* See also ::jd.
|
||
*/
|
||
static VALUE
|
||
date_s_valid_jd_p(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* Date.valid_date?(2001,2,3) #=> true
|
||
* Date.valid_date?(2001,2,29) #=> false
|
||
*
|
||
* See also jd and civil.
|
||
* See also ::jd and ::civil.
|
||
*/
|
||
static VALUE
|
||
date_s_valid_civil_p(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* Date.valid_ordinal?(2001,34) #=> true
|
||
* Date.valid_ordinal?(2001,366) #=> false
|
||
*
|
||
* See also jd and ordinal.
|
||
* See also ::jd and ::ordinal.
|
||
*/
|
||
static VALUE
|
||
date_s_valid_ordinal_p(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* Date.valid_commercial?(2001,5,6) #=> true
|
||
* Date.valid_commercial?(2001,5,8) #=> false
|
||
*
|
||
* See also jd and commercial.
|
||
* See also ::jd and ::commercial.
|
||
*/
|
||
static VALUE
|
||
date_s_valid_commercial_p(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* Date.jd(2451945) #=> #<Date: 2001-02-04 ...>
|
||
* Date.jd(0) #=> #<Date: -4712-01-01 ...>
|
||
*
|
||
* See also new.
|
||
* See also ::new.
|
||
*/
|
||
static VALUE
|
||
date_s_jd(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* Date.ordinal(2001,34) #=> #<Date: 2001-02-03 ...>
|
||
* Date.ordinal(2001,-1) #=> #<Date: 2001-12-31 ...>
|
||
*
|
||
* See also jd and new.
|
||
* See also ::jd and ::new.
|
||
*/
|
||
static VALUE
|
||
date_s_ordinal(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* Date.new(2001,2,3) #=> #<Date: 2001-02-03 ...>
|
||
* Date.new(2001,2,-1) #=> #<Date: 2001-02-28 ...>
|
||
*
|
||
* See also jd.
|
||
* See also ::jd.
|
||
*/
|
||
static VALUE
|
||
date_s_civil(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* Date.commercial(2002) #=> #<Date: 2001-12-31 ...>
|
||
* Date.commercial(2001,5,6) #=> #<Date: 2001-02-03 ...>
|
||
*
|
||
* See also jd and new.
|
||
* See also ::jd and ::new.
|
||
*/
|
||
static VALUE
|
||
date_s_commercial(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* call-seq:
|
||
* Date.today([start=Date::ITALY]) -> date
|
||
*
|
||
* Date.today #=> #<Date: 2011-06-11 ..>
|
||
*
|
||
* Creates a date object denoting the present day.
|
||
*
|
||
* Date.today #=> #<Date: 2011-06-11 ...>
|
||
*/
|
||
static VALUE
|
||
date_s_today(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
* Date._strptime('2001-02-03', '%Y-%m-%d')
|
||
* #=> {:year=>2001, :mon=>2, :mday=>3}
|
||
*
|
||
* See also strptime(3) and strftime.
|
||
* See also strptime(3) and #strftime.
|
||
*/
|
||
static VALUE
|
||
date_s__strptime(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* Date.strptime([string='-4712-01-01'[, format='%F'[, start=ITALY]]]) -> date
|
||
* Date.strptime([string='-4712-01-01'[, format='%F'[, start=Date::ITALY]]]) -> date
|
||
*
|
||
* Parses the given representation of date and time with the given
|
||
* template, and creates a date object. strptime does not support
|
||
... | ... | |
* Date.strptime('2001 05 6', '%Y %W %u') #=> #<Date: 2001-02-03 ...>
|
||
* Date.strptime('sat3feb01', '%a%d%b%y') #=> #<Date: 2001-02-03 ...>
|
||
*
|
||
* See also strptime(3) and strftime.
|
||
* See also strptime(3) and #strftime.
|
||
*/
|
||
static VALUE
|
||
date_s_strptime(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* Date.parse(string='-4712-01-01'[, comp=true[, start=ITALY]]) -> date
|
||
* Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]]) -> date
|
||
*
|
||
* Parses the given representation of date and time, and creates a
|
||
* date object. This method does not function as a validator.
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* Date.iso8601(string='-4712-01-01'[, start=ITALY]) -> date
|
||
* Date.iso8601(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* some typical ISO 8601 formats.
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> date
|
||
* Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> date
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* some typical RFC 3339 formats.
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* Date.xmlschema(string='-4712-01-01'[, start=ITALY]) -> date
|
||
* Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* some typical XML Schema formats.
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> date
|
||
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> date
|
||
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date
|
||
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* some typical RFC 2822 formats.
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=ITALY]) -> date
|
||
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]) -> date
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* some RFC 2616 format.
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* Date.jisx0301(string='-4712-01-01'[, start=ITALY]) -> date
|
||
* Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY]) -> date
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* some typical JIS X 0301 formats.
|
||
... | ... | |
* call-seq:
|
||
* d.new_start([start=Date::ITALY]) -> date
|
||
*
|
||
* Duplicates self and resets its the day of calendar reform.
|
||
* Duplicates self and resets its day of calendar reform.
|
||
*
|
||
* d = Date.new(1582,10,15)
|
||
* d.new_start(Date::JULIAN) #=> #<Date: 1582-10-05 ...>
|
||
... | ... | |
* call-seq:
|
||
* d + other -> date
|
||
*
|
||
* Returns a date object pointing other days after self. The other
|
||
* should be a numeric value. If the other is flonum, assumes its
|
||
* precision is at most nanosecond.
|
||
* Returns a date object pointing +other+ days after self. The other
|
||
* should be a numeric value. If the other is a fractional number,
|
||
* assumes its precision is at most nanosecond.
|
||
*
|
||
* Date.new(2001,2,3) + 1 #=> #<Date: 2001-02-04 ...>
|
||
* DateTime.new(2001,2,3) + Rational(1,2)
|
||
... | ... | |
*
|
||
* Returns the difference between the two dates if the other is a date
|
||
* object. If the other is a numeric value, returns a date object
|
||
* pointing other days before self. If the other is flonum, assumes
|
||
* its precision is at most nanosecond.
|
||
* pointing +other+ days before self. If the other is a fractional number,
|
||
* assumes its precision is at most nanosecond.
|
||
*
|
||
* Date.new(2001,2,3) - 1 #=> #<Date: 2001-02-02 ...>
|
||
* DateTime.new(2001,2,3) - Rational(1,2)
|
||
... | ... | |
* call-seq:
|
||
* d >> n -> date
|
||
*
|
||
* Returns a date object pointing n months after self. The n should
|
||
* be a numeric value.
|
||
* Returns a date object pointing +n+ months after self.
|
||
* The argument +n+ should be a numeric value.
|
||
*
|
||
* Date.new(2001,2,3) >> 1 #=> #<Date: 2001-03-03 ...>
|
||
* Date.new(2001,1,31) >> 1 #=> #<Date: 2001-02-28 ...>
|
||
* Date.new(2001,2,3) >> -2 #=> #<Date: 2000-12-03 ...>
|
||
* Date.new(2001,2,3) >> 1 #=> #<Date: 2001-03-03 ...>
|
||
* Date.new(2001,1,30) >> 1 #=> #<Date: 2001-02-28 ...>
|
||
* Date.new(2001,1,31) >> 1 #=> #<Date: 2001-02-28 ...>
|
||
* Date.new(2001,2,3) >> -2 #=> #<Date: 2000-12-03 ...>
|
||
*/
|
||
static VALUE
|
||
d_lite_rshift(VALUE self, VALUE other)
|
||
... | ... | |
* call-seq:
|
||
* d << n -> date
|
||
*
|
||
* Returns a date object pointing n months before self. The n should
|
||
* be a numeric value.
|
||
* Returns a date object pointing +n+ months before self.
|
||
* The argument +n+ should be a numeric value.
|
||
*
|
||
* Date.new(2001,2,3) << 1 #=> #<Date: 2001-01-03 ...>
|
||
* Date.new(2001,1,31) << 11 #=> #<Date: 2000-02-29 ...>
|
||
* Date.new(2001,2,3) << -1 #=> #<Date: 2001-03-03 ...>
|
||
* Date.new(2001,2,3) << 1 #=> #<Date: 2001-01-03 ...>
|
||
* Date.new(2001,1,30) << 11 #=> #<Date: 2000-02-29 ...>
|
||
* Date.new(2001,1,31) << 11 #=> #<Date: 2000-02-29 ...>
|
||
* Date.new(2001,2,3) << -1 #=> #<Date: 2001-03-03 ...>
|
||
*/
|
||
static VALUE
|
||
d_lite_lshift(VALUE self, VALUE other)
|
||
... | ... | |
* call-seq:
|
||
* d.next_month([n=1]) -> date
|
||
*
|
||
* This method is equivalent to d >> n
|
||
* This method is equivalent to d >> n.
|
||
*/
|
||
static VALUE
|
||
d_lite_next_month(int argc, VALUE *argv, VALUE self)
|
||
... | ... | |
* call-seq:
|
||
* d.prev_month([n=1]) -> date
|
||
*
|
||
* This method is equivalent to d << n
|
||
* This method is equivalent to d << n.
|
||
*/
|
||
static VALUE
|
||
d_lite_prev_month(int argc, VALUE *argv, VALUE self)
|
||
... | ... | |
* call-seq:
|
||
* d.next_year([n=1]) -> date
|
||
*
|
||
* This method is equivalent to d >> (n * 12)
|
||
* This method is equivalent to d >> (n * 12).
|
||
*/
|
||
static VALUE
|
||
d_lite_next_year(int argc, VALUE *argv, VALUE self)
|
||
... | ... | |
* call-seq:
|
||
* d.prev_year([n=1]) -> date
|
||
*
|
||
* This method is equivalent to d << (n * 12)
|
||
* This method is equivalent to d << (n * 12).
|
||
*/
|
||
static VALUE
|
||
d_lite_prev_year(int argc, VALUE *argv, VALUE self)
|
||
... | ... | |
* should be a date object or a numeric value as an astronomical
|
||
* Julian day number.
|
||
*
|
||
* Date.new(2001,2,3) <=> Date.new(2001,2,4) #=> -1
|
||
* Date.new(2001,2,3) <=> Date.new(2001,2,3) #=> 0
|
||
* Date.new(2001,2,3) <=> Date.new(2001,2,2) #=> 1
|
||
* Date.new(2001,2,3) <=> Object.new #=> nil
|
||
* Date.new(2001,2,3) <=> Rational(4903887,2)#=> 0
|
||
* Date.new(2001,2,3) <=> Date.new(2001,2,4) #=> -1
|
||
* Date.new(2001,2,3) <=> Date.new(2001,2,3) #=> 0
|
||
* Date.new(2001,2,3) <=> Date.new(2001,2,2) #=> 1
|
||
* Date.new(2001,2,3) <=> Object.new #=> nil
|
||
* Date.new(2001,2,3) <=> Rational(4903887,2) #=> 0
|
||
*
|
||
* See also Comparable.
|
||
*/
|
||
... | ... | |
* call-seq:
|
||
* d.to_s -> string
|
||
*
|
||
* Returns a string in an ISO 8601 format (This method doesn't use the
|
||
* expanded representations).
|
||
* Returns a string in an ISO 8601 format. (This method doesn't use the
|
||
* expanded representations.)
|
||
*
|
||
* Date.new(2001,2,3).to_s #=> "2001-02-03"
|
||
*/
|
||
... | ... | |
*
|
||
* Formats date according to the directives in the given format
|
||
* string.
|
||
* The directives begins with a percent (%) character.
|
||
* The directives begin with a percent (%) character.
|
||
* Any text not listed as a directive will be passed through to the
|
||
* output string.
|
||
*
|
||
... | ... | |
* %T - 24-hour time (%H:%M:%S)
|
||
* %+ - date(1) (%a %b %e %H:%M:%S %Z %Y)
|
||
*
|
||
* This method is similar to strftime() function defined in ISO C and POSIX.
|
||
* This method is similar to the strftime() function defined in ISO C
|
||
* and POSIX.
|
||
* Several directives (%a, %A, %b, %B, %c, %p, %r, %x, %X, %E*, %O* and %Z)
|
||
* are locale dependent in the function.
|
||
* However this method is locale independent.
|
||
* So, the result may differ even if a same format string is used in other
|
||
* However, this method is locale independent.
|
||
* So, the result may differ even if the same format string is used in other
|
||
* systems such as C.
|
||
* It is good practice to avoid %x and %X because there are corresponding
|
||
* locale independent representations, %D and %T.
|
||
... | ... | |
* %GW%V%uT%H%M%z => 2007W471T0837-0600 Week date and local time and difference from UTC (basic)
|
||
* %G-W%V-%uT%R%:z => 2007-W47-1T08:37-06:00 Week date and local time and difference from UTC (extended)
|
||
*
|
||
* See also strftime(3) and strptime.
|
||
* See also strftime(3) and ::strptime.
|
||
*/
|
||
static VALUE
|
||
d_lite_strftime(int argc, VALUE *argv, VALUE self)
|
||
... | ... | |
* call-seq:
|
||
* DateTime.jd([jd=0[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]) -> datetime
|
||
*
|
||
* Creates a datetime object denoting the given chronological Julian
|
||
* Creates a DateTime object denoting the given chronological Julian
|
||
* day number.
|
||
*
|
||
* DateTime.jd(2451944) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
||
... | ... | |
* call-seq:
|
||
* DateTime.ordinal([year=-4712[, yday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]) -> datetime
|
||
*
|
||
* Creates a date-time object denoting the given ordinal date.
|
||
* Creates a DateTime object denoting the given ordinal date.
|
||
*
|
||
* DateTime.ordinal(2001,34) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
||
* DateTime.ordinal(2001,34,4,5,6,'+7')
|
||
... | ... | |
* DateTime.civil([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
||
* DateTime.new([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
||
*
|
||
* Creates a date-time object denoting the given calendar date.
|
||
* Creates a DateTime object denoting the given calendar date.
|
||
*
|
||
* DateTime.new(2001,2,3) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
||
* DateTime.new(2001,2,3,4,5,6,'+7')
|
||
... | ... | |
* call-seq:
|
||
* DateTime.commercial([cwyear=-4712[, cweek=1[, cwday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
||
*
|
||
* Creates a date-time object denoting the given week date.
|
||
* Creates a DateTime object denoting the given week date.
|
||
*
|
||
* DateTime.commercial(2001) #=> #<DateTime: 2001-01-01T00:00:00+00:00 ...>
|
||
* DateTime.commercial(2002) #=> #<DateTime: 2001-12-31T00:00:00+00:00 ...>
|
||
... | ... | |
* call-seq:
|
||
* DateTime.now([start=Date::ITALY]) -> datetime
|
||
*
|
||
* Creates a date-time object denoting the present time.
|
||
* Creates a DateTime object denoting the present time.
|
||
*
|
||
* DateTime.now #=> #<DateTime: 2011-06-11T21:20:44+09:00 ...>
|
||
*/
|
||
... | ... | |
* template, and returns a hash of parsed elements. _strptime does
|
||
* not support specification of flags and width unlike strftime.
|
||
*
|
||
* See also strptime(3) and strftime.
|
||
* See also strptime(3) and #strftime.
|
||
*/
|
||
static VALUE
|
||
datetime_s__strptime(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* DateTime.strptime([string='-4712-01-01T00:00:00+00:00'[, format='%FT%T%z'[ ,start=ITALY]]]) -> datetime
|
||
* DateTime.strptime([string='-4712-01-01T00:00:00+00:00'[, format='%FT%T%z'[ ,start=Date::ITALY]]]) -> datetime
|
||
*
|
||
* Parses the given representation of date and time with the given
|
||
* template, and creates a date object. strptime does not support
|
||
* template, and creates a DateTime object. strptime does not support
|
||
* specification of flags and width unlike strftime.
|
||
*
|
||
* DateTime.strptime('2001-02-03T04:05:06+07:00', '%Y-%m-%dT%H:%M:%S%z')
|
||
... | ... | |
* DateTime.strptime('sat3feb014pm+7', '%a%d%b%y%H%p%z')
|
||
* #=> #<DateTime: 2001-02-03T16:00:00+07:00 ...>
|
||
*
|
||
* See also strptime(3) and strftime.
|
||
* See also strptime(3) and #strftime.
|
||
*/
|
||
static VALUE
|
||
datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=ITALY]]) -> datetime
|
||
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]]) -> datetime
|
||
*
|
||
* Parses the given representation of date and time, and creates a
|
||
* date object. This method does not function as a validator.
|
||
* DateTime object. This method does not function as a validator.
|
||
*
|
||
* If the optional second argument is true and the detected year is in
|
||
* the range "00" to "99", makes it full.
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> datetime
|
||
* DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* Creates a new DateTime object by parsing from a string according to
|
||
* some typical ISO 8601 formats.
|
||
*
|
||
* DateTime.iso8601('2001-02-03T04:05:06+07:00')
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> datetime
|
||
* DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* Creates a new DateTime object by parsing from a string according to
|
||
* some typical RFC 3339 formats.
|
||
*
|
||
* DateTime.rfc3339('2001-02-03T04:05:06+07:00')
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> datetime
|
||
* DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* Creates a new DateTime object by parsing from a string according to
|
||
* some typical XML Schema formats.
|
||
*
|
||
* DateTime.xmlschema('2001-02-03T04:05:06+07:00')
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> datetime
|
||
* DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> datetime
|
||
* DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> datetime
|
||
* DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> datetime
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* Creates a new DateTime object by parsing from a string according to
|
||
* some typical RFC 2822 formats.
|
||
*
|
||
* DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700')
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* DateTime.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=ITALY]) -> datetime
|
||
* DateTime.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]) -> datetime
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* Creates a new DateTime object by parsing from a string according to
|
||
* some RFC 2616 format.
|
||
*
|
||
* DateTime.httpdate('Sat, 03 Feb 2001 04:05:06 GMT')
|
||
... | ... | |
/*
|
||
* call-seq:
|
||
* DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> datetime
|
||
* DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime
|
||
*
|
||
* Creates a new Date object by parsing from a string according to
|
||
* Creates a new DateTime object by parsing from a string according to
|
||
* some typical JIS X 0301 formats.
|
||
*
|
||
* DateTime.jisx0301('H13.02.03T04:05:06+07:00')
|
||
... | ... | |
* call-seq:
|
||
* dt.to_s -> string
|
||
*
|
||
* Returns a string in an ISO 8601 format (This method doesn't use the
|
||
* expanded representations).
|
||
* Returns a string in an ISO 8601 format. (This method doesn't use the
|
||
* expanded representations.)
|
||
*
|
||
* DateTime.new(2001,2,3,4,5,6,'-7').to_s
|
||
* #=> "2001-02-03T04:05:06-07:00"
|
||
... | ... | |
*
|
||
* Formats date according to the directives in the given format
|
||
* string.
|
||
* The directives begins with a percent (%) character.
|
||
* The directives begin with a percent (%) character.
|
||
* Any text not listed as a directive will be passed through to the
|
||
* output string.
|
||
*
|
||
... | ... | |
*
|
||
* The minimum field width specifies the minimum width.
|
||
*
|
||
* The modifier is "E" and "O".
|
||
* The modifiers are "E" and "O".
|
||
* They are ignored.
|
||
*
|
||
* Format directives:
|
||
... | ... | |
* %T - 24-hour time (%H:%M:%S)
|
||
* %+ - date(1) (%a %b %e %H:%M:%S %Z %Y)
|
||
*
|
||
* This method is similar to strftime() function defined in ISO C and POSIX.
|
||
* This method is similar to the strftime() function defined in ISO C
|
||
* and POSIX.
|
||
* Several directives (%a, %A, %b, %B, %c, %p, %r, %x, %X, %E*, %O* and %Z)
|
||
* are locale dependent in the function.
|
||
* However this method is locale independent.
|
||
* So, the result may differ even if a same format string is used in other
|
||
* However, this method is locale independent.
|
||
* So, the result may differ even if the same format string is used in other
|
||
* systems such as C.
|
||
* It is good practice to avoid %x and %X because there are corresponding
|
||
* locale independent representations, %D and %T.
|
||
... | ... | |
* %GW%V%uT%H%M%z => 2007W471T0837-0600 Week date and local time and difference from UTC (basic)
|
||
* %G-W%V-%uT%R%:z => 2007-W47-1T08:37-06:00 Week date and local time and difference from UTC (extended)
|
||
*
|
||
* See also strftime(3) and strptime.
|
||
* See also strftime(3) and ::strptime.
|
||
*/
|
||
static VALUE
|
||
dt_lite_strftime(int argc, VALUE *argv, VALUE self)
|
||
... | ... | |
* dt.xmlschema([n=0]) -> string
|
||
*
|
||
* This method is equivalent to strftime('%FT%T'). The optional
|
||
* argument n is length of fractional seconds.
|
||
* argument +n+ is the number of digits for fractional seconds.
|
||
*
|
||
* DateTime.parse('2001-02-03T04:05:06.123456789+07:00').iso8601(9)
|
||
* #=> "2001-02-03T04:05:06.123456789+07:00"
|
||
... | ... | |
/*
|
||
* date and datetime class - Tadayoshi Funaba 1998-2011
|
||
*
|
||
* 'date' provides two classes Date and DateTime.
|
||
* 'date' provides two classes: Date and DateTime.
|
||
*
|
||
* == Terms and definitions
|
||
* == Terms and Definitions
|
||
*
|
||
* Some terms and definitions are based on ISO 8601 and JIS X 0301.
|
||
*
|
||
* === calendar date
|
||
* === Calendar Date
|
||
*
|
||
* The calendar date is a particular day of a calendar year,
|
||
* identified by its ordinal number within a calendar month within
|
||
... | ... | |
*
|
||
* In those classes, this is so-called "civil".
|
||
*
|
||
* === ordinal date
|
||
* === Ordinal Date
|
||
*
|
||
* The ordinal date is a particular day of a calendar year identified
|
||
* by its ordinal number within the year.
|
||
*
|
||
* In those classes, this is so-called "ordinal".
|
||
*
|
||
* === week date
|
||
* === Week Date
|
||
*
|
||
* The week date is a date identified by calendar week and day numbers.
|
||
*
|
||
... | ... | |
* includes the first Thursday of that year. In the Gregorian
|
||
* calendar, this is equivalent to the week which includes January 4.
|
||
*
|
||
* In those classes, this so-called "commercial".
|
||
* In those classes, this is so-called "commercial".
|
||
*
|
||
* === julian day number
|
||
* === Julian Day Number
|
||
*
|
||
* The Julian day number is in elapsed days since noon (Greenwich mean
|
||
* time) on January 1, 4713 BCE (in the Julian calendar).
|
||
* 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
|
||
* In this document, the astronomical Julian day number is the 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 those classes, those are so-called "ajd" and "jd".
|
||
*
|
||
* === modified julian day number
|
||
* === Modified Julian Day Number
|
||
*
|
||
* The modified Julian day number is in elapsed days since midnight
|
||
* (Coordinated universal time) on November 17, 1858 CE (in the
|
||
* (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
|
||
* the 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.
|
||
... | ... | |
* appears, it just refers to "chronological modified Julian day
|
||
* number", not the original.
|
||
*
|
||
* In those classes, this is so-called "mjd".
|
||
* In those classes, those are so-called "amjd" and "mjd".
|
||
*
|
||
* == Date
|
||
*
|
||
* A subclass of Object that includes Comparable module and easily handles
|
||
* date.
|
||
* A subclass of Object that includes the Comparable module and
|
||
* easily handles date.
|
||
*
|
||
* Date object is created with Date::new, Date::jd, Date::ordinal,
|
||
* A Date object is created with Date::new, Date::jd, Date::ordinal,
|
||
* Date::commercial, Date::parse, Date::strptime, Date::today,
|
||
* Time#to_date or etc.
|
||
* Time#to_date, etc.
|
||
*
|
||
* require 'date'
|
||
*
|
||
... | ... | |
*
|
||
* All date objects are immutable; hence cannot modify themselves.
|
||
*
|
||
* The concept of this date object can be represented as a tuple
|
||
* The concept of a date object can be represented as a tuple
|
||
* of the day count, the offset and the day of calendar reform.
|
||
*
|
||
* The day count denotes the absolute position of a temporal
|
||
... | ... | |
* The offset in this class is usually zero, and cannot be
|
||
* specified directly.
|
||
*
|
||
* An optional argument the day of calendar reform (start) as a
|
||
* Julian day number, which should be 2298874 to 2426355 or -/+oo.
|
||
* The default value is Date::ITALY (2299161=1582-10-15). See
|
||
* also sample/cal.rb.
|
||
* A Date object can be created with an optional argument,
|
||
* the day of calendar reform as a Julian day number, which
|
||
* should be 2298874 to 2426355 or negative/positive infinity.
|
||
* The default value is +Date::ITALY+ (2299161=1582-10-15).
|
||
* See also sample/cal.rb.
|
||
*
|
||
* $ ruby sample/cal.rb -c it 10 1582
|
||
* October 1582
|
||
... | ... | |
* 17 18 19 20 21 22 23
|
||
* 24 25 26 27 28 29 30
|
||
*
|
||
* Date object has various methods. See each reference.
|
||
* A Date object has various methods. See each reference.
|
||
*
|
||
* d = Date.parse('3rd Feb 2001')
|
||
* #=> #<Date: 2001-02-03 ...>
|
||
... | ... | |
rb_define_const(cDate, "ENGLAND", INT2FIX(ENGLAND));
|
||
/* The Julian day number of the day of calendar reform for the
|
||
* proleptic Julian calendar
|
||
* proleptic Julian calendar.
|
||
*/
|
||
rb_define_const(cDate, "JULIAN", DBL2NUM(JULIAN));
|
||
/* The Julian day number of the day of calendar reform for the
|
||
* proleptic Gregorian calendar
|
||
* proleptic Gregorian calendar.
|
||
*/
|
||
rb_define_const(cDate, "GREGORIAN", DBL2NUM(GREGORIAN));
|
||
... | ... | |
/*
|
||
* == DateTime
|
||
*
|
||
* A subclass of Date that easily handles date, hour, minute, second and
|
||
* offset.
|
||
* A subclass of Date that easily handles date, hour, minute, second,
|
||
* and offset.
|
||
*
|
||
* DateTime does not consider any leap seconds, does not track
|
||
* any summer time rules.
|
||
*
|
||
* DateTime object is created with DateTime::new, DateTime::jd,
|
||
* A DateTime object is created with DateTime::new, DateTime::jd,
|
||
* DateTime::ordinal, DateTime::commercial, DateTime::parse,
|
||
* DateTime::strptime, DateTime::now, Time#to_datetime or etc.
|
||
* DateTime::strptime, DateTime::now, Time#to_datetime, etc.
|
||
*
|
||
* require 'date'
|
||
*
|
||
* DateTime.new(2001,2,3,4,5,6)
|
||
* #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
|
||
*
|
||
* The last element of day, hour, minute or second can be
|
||
* The last element of day, hour, minute, or second can be a
|
||
* fractional number. The fractional number's precision is assumed
|
||
* at most nanosecond.
|
||
*
|
||
* DateTime.new(2001,2,3.5)
|
||
* #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...>
|
||
*
|
||
* An optional argument the offset indicates the difference
|
||
* An optional argument, the offset, indicates the difference
|
||
* between the local time and UTC. For example, <tt>Rational(3,24)</tt>
|
||
* represents ahead of 3 hours of UTC, <tt>Rational(-5,24)</tt> represents
|
||
* behind of 5 hours of UTC. The offset should be -1 to +1, and
|
||
* its precision is assumed at most second. The default value is
|
||
* zero(equals to UTC).
|
||
* zero (equals to UTC).
|
||
*
|
||
* DateTime.new(2001,2,3,4,5,6,Rational(3,24))
|
||
* #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
|
||
*
|
||
* also accepts string form.
|
||
* The offset also accepts string form:
|
||
*
|
||
* DateTime.new(2001,2,3,4,5,6,'+03:00')
|
||
* #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
|
||
*
|
||
* An optional argument the day of calendar reform (start) denotes
|
||
* An optional argument, the day of calendar reform (+start+), denotes
|
||
* a Julian day number, which should be 2298874 to 2426355 or
|
||
* -/+oo. The default value is +Date::ITALY+ (2299161=1582-10-15).
|
||
* negative/positive infinity.
|
||
* The default value is +Date::ITALY+ (2299161=1582-10-15).
|
||
*
|
||
* DateTime object has various methods. See each reference.
|
||
* A DateTime object has various methods. See each reference.
|
||
*
|
||
* d = DateTime.parse('3rd Feb 2001 04:05:06+03:30')
|
||
* #=> #<DateTime: 2001-02-03T04:05:06+03:30 ...>
|
||
... | ... | |
* died on the same day in history -
|
||
* so much so that UNESCO named April 23 as
|
||
* {World Book Day because of this fact}[http://en.wikipedia.org/wiki/World_Book_Day].
|
||
* However because England hadn't yet adopted
|
||
* However, because England hadn't yet adopted the
|
||
* {Gregorian Calendar Reform}[http://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform]
|
||
* (and wouldn't until {1752}[http://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750])
|
||
* their deaths are actually 10 days apart.
|
||
* Since Ruby's Time class implements a
|
||
* {proleptic Gregorian calendar}[http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar]
|
||
* and has no concept of calendar reform then there's no way
|
||
* to express this. This is where DateTime steps in:
|
||
* and has no concept of calendar reform there's no way
|
||
* to express this with Time objects. This is where DateTime steps in:
|
||
*
|
||
* shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
|
||
* #=> Tue, 23 Apr 1616 00:00:00 +0000
|
||
* cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
|
||
* #=> Sat, 23 Apr 1616 00:00:00 +0000
|
||
*
|
||
* Already you can see something's weird - the days of the week
|
||
* are different, taking this further:
|
||
* Already you can see something is weird - the days of the week
|
||
* are different. Taking this further:
|
||
*
|
||
* cervantes == shakespeare
|
||
* #=> false
|