Method: Date#year

Defined in:
ext/date/date_core.c

#yearInteger

Returns the year:

Date.new(2001, 2, 3).year    # => 2001
(Date.new(1, 1, 1) - 1).year # => 0

Returns:

  • (Integer)


5300
5301
5302
5303
5304
5305
# File 'ext/date/date_core.c', line 5300

static VALUE
d_lite_year(VALUE self)
{
    get_d1(self);
    return m_real_year(dat);
}