DateTime.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 DateTime
    @property @safe pure
    void
    year
    (
    int year
    )

Parameters

year int

The year to set this DateTime's year to.

Throws

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

Examples

assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).year == 1999);
assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).year == 2010);
assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).year == -7);

Meta