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_time.year_bc
- multiple declarations
- Function DateTime.yearBC
- Function DateTime.yearBC
Function DateTime.yearBC
Year B.C. of the Gregorian Calendar counting year
0 as 1 B.C.
Prototype
void yearBC( int year ) pure @property @safe;
Parameters
Name | Description |
---|---|
year | The year B.C. to set this DateTime 's year to. |
Throws
DateTimeException
if a non-positive value is given.
Example
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)));
Function DateTime.yearBC
Year B.C. of the Gregorian Calendar counting year
0 as 1 B.C.
Prototype
short yearBC() pure @property @safe const;
Throws
DateTimeException
if
is true.
isAD
Example
assert(DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33)).yearBC == 1); assert(DateTime(Date(-1, 1, 1), TimeOfDay(10, 7, 2)).yearBC == 2); assert(DateTime(Date(-100, 1, 1), TimeOfDay(4, 59, 0)).yearBC == 101);
Authors
Jonathan M Davis and Kato Shoichi