View source code
Display the source code in std/datetime/systime.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.systime.SysTime.dayOfGregorianCal - multiple declarations

Function SysTime.dayOfGregorianCal

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

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

Example

import core.time;
import std.datetime.date : DateTime;

writeln(SysTime(DateTime(1, 1, 1, 0, 0, 0)).dayOfGregorianCal); // 1
writeln(SysTime(DateTime(1, 12, 31, 23, 59, 59)).dayOfGregorianCal); // 365
writeln(SysTime(DateTime(2, 1, 1, 2, 2, 2)).dayOfGregorianCal); // 366

writeln(SysTime(DateTime(0, 12, 31, 7, 7, 7)).dayOfGregorianCal); // 0
writeln(SysTime(DateTime(0, 1, 1, 19, 30, 0)).dayOfGregorianCal); // -365
writeln(SysTime(DateTime(-1, 12, 31, 4, 7, 0)).dayOfGregorianCal); // -366

writeln(SysTime(DateTime(2000, 1, 1, 9, 30, 20)).dayOfGregorianCal); // 730_120
writeln(SysTime(DateTime(2010, 12, 31, 15, 45, 50)).dayOfGregorianCal); // 734_137

Function SysTime.dayOfGregorianCal

The Xth day of the Gregorian Calendar that this SysTime is on. Setting this property does not affect the time portion of SysTime.

void dayOfGregorianCal (
  int days
) nothrow @property scope @safe;

Parameters

NameDescription
days The day of the Gregorian Calendar to set this SysTime to.

Example

import core.time;
import std.datetime.date : DateTime;

auto st = SysTime(DateTime(0, 1, 1, 12, 0, 0));
st.dayOfGregorianCal = 1;
writeln(st); // SysTime(DateTime(1, 1, 1, 12, 0, 0))

st.dayOfGregorianCal = 365;
writeln(st); // SysTime(DateTime(1, 12, 31, 12, 0, 0))

st.dayOfGregorianCal = 366;
writeln(st); // SysTime(DateTime(2, 1, 1, 12, 0, 0))

st.dayOfGregorianCal = 0;
writeln(st); // SysTime(DateTime(0, 12, 31, 12, 0, 0))

st.dayOfGregorianCal = -365;
writeln(st); // SysTime(DateTime(-0, 1, 1, 12, 0, 0))

st.dayOfGregorianCal = -366;
writeln(st); // SysTime(DateTime(-1, 12, 31, 12, 0, 0))

st.dayOfGregorianCal = 730_120;
writeln(st); // SysTime(DateTime(2000, 1, 1, 12, 0, 0))

st.dayOfGregorianCal = 734_137;
writeln(st); // SysTime(DateTime(2010, 12, 31, 12, 0, 0))

Authors

Jonathan M Davis

License

Boost License 1.0.