DateTime.yearBC

Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C.

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

Parameters

year int

The year B.C. to set this DateTime's year to.

Throws

std.datetime.date.DateTimeException if a non-positive value is given.

Examples

auto dt = DateTime(Date(2010, 1, 1), TimeOfDay(7, 30, 0));
dt.yearBC = 1;
assert(dt == DateTime(Date(0, 1, 1), TimeOfDay(7, 30, 0)));

dt.yearBC = 10;
assert(dt == DateTime(Date(-9, 1, 1), TimeOfDay(7, 30, 0)));

Meta