View source code
Display the source code in std/datetime/date.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
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.

std.datetime.date.Date.dayOfGregorianCal - multiple declarations

Function Date.dayOfGregorianCal

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

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

Example

writeln(Date(1, 1, 1).dayOfGregorianCal); // 1
writeln(Date(1, 12, 31).dayOfGregorianCal); // 365
writeln(Date(2, 1, 1).dayOfGregorianCal); // 366

writeln(Date(0, 12, 31).dayOfGregorianCal); // 0
writeln(Date(0, 1, 1).dayOfGregorianCal); // -365
writeln(Date(-1, 12, 31).dayOfGregorianCal); // -366

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

Function Date.dayOfGregorianCal

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

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

Parameters

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

Example

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

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

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

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

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

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

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

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

Authors

Jonathan M Davis

License

Boost License 1.0.