Date.year

Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C.

  1. short year [@property getter]
  2. int year [@property setter]
    struct Date
    @property @safe pure
    void
    year
    (
    int year
    )

Parameters

year int

The year to set this Date's year to.

Throws

std.datetime.date.DateTimeException if the new year is not a leap year and the resulting date would be on February 29th.

Examples

assert(Date(1999, 7, 6).year == 1999);
assert(Date(2010, 10, 4).year == 2010);
assert(Date(-7, 4, 5).year == -7);

Meta