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

Parameters

year int

The year to set this SysTime'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

import std.datetime.date : DateTime;

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

Meta