View source code Display the source code in std/datetime.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.datetime.date.day_of_gregorian_cal - multiple declarations

Function Date.dayOfGregorianCal

The Xth day of the Gregorian Calendar that this Date is on.

Prototype

void dayOfGregorianCal(
  int day
) pure nothrow @property @safe;

Parameters

NameDescription
day The day of the Gregorian Calendar to set this Date to.

Example

auto date = Date.init;
date.dayOfGregorianCal = 1;
assert(date == Date(1, 1, 1));

date.dayOfGregorianCal = 365;
assert(date == Date(1, 12, 31));

date.dayOfGregorianCal = 366;
assert(date == Date(2, 1, 1));

date.dayOfGregorianCal = 0;
assert(date == Date(0, 12, 31));

date.dayOfGregorianCal = -365;
assert(date == Date(-0, 1, 1));

date.dayOfGregorianCal = -366;
assert(date == Date(-1, 12, 31));

date.dayOfGregorianCal = 730_120;
assert(date == Date(2000, 1, 1));

date.dayOfGregorianCal = 734_137;
assert(date == Date(2010, 12, 31));


Function Date.dayOfGregorianCal

The Xth day of the Gregorian Calendar that this Date is on.

Prototype

int dayOfGregorianCal() pure nothrow @property @safe const;

Example

assert(Date(1, 1, 1).dayOfGregorianCal == 1);
assert(Date(1, 12, 31).dayOfGregorianCal == 365);
assert(Date(2, 1, 1).dayOfGregorianCal == 366);

assert(Date(0, 12, 31).dayOfGregorianCal == 0);
assert(Date(0, 1, 1).dayOfGregorianCal == -365);
assert(Date(-1, 12, 31).dayOfGregorianCal == -366);

assert(Date(2000, 1, 1).dayOfGregorianCal == 730_120);
assert(Date(2010, 12, 31).dayOfGregorianCal == 734_137);


Authors

Jonathan M Davis and Kato Shoichi

License

Boost License 1.0.

Comments