Time

Represents a point in time.

Remarks: Time represents dates and times between 12:00:00 midnight on January 1, 10000 BC and 11:59:59 PM on December 31, 9999 AD.

Time values are measured in 100-nanosecond intervals, or ticks. A date value is the number of ticks that have elapsed since 12:00:00 midnight on January 1, 0001 AD in the Gregorian calendar.

Negative Time values are offsets from that same reference point, but backwards in history. Time values are not specific to any calendar, but for an example, the beginning of December 31, 1 BC in the Gregorian calendar is Time.epoch - TimeSpan.days(1).

Members

Functions

opBinary
Time opBinary(const(TimeSpan) t)

Adds the specified time span to the time, returning a new time.

opBinary
Time opBinary(const(TimeSpan) t)

Subtracts the specified time span from the time, returning a new time.

opBinary
TimeSpan opBinary(const(Time) t)

Returns a time span which represents the difference in time between this and the given Time.

opCmp
int opCmp(Time t)

Compares two Time values.

opCmp
int opCmp(Time t)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(const(Time) t)

Determines whether two Time values are equal.

opOpAssign
Time opOpAssign(const(TimeSpan) t)

Adds the specified time span to the time, assigning the result to this instance.

opOpAssign
Time opOpAssign(const(TimeSpan) t)

Subtracts the specified time span from the time, assigning the result to this instance.

Properties

date
Time date [@property getter]

Property. Retrieves the date component.

span
TimeSpan span [@property getter]

Property. Retrieves the equivalent TimeSpan.

ticks
long ticks [@property getter]

Property. Retrieves the number of ticks for this Time. This value can be used to construct another Time struct by writing:

time
TimeOfDay time [@property getter]

Property. Retrieves the time of day.

unix
TimeSpan unix [@property getter]

Property. Retrieves a TimeSpan that corresponds to Unix time (time since 1/1/1970). Use the TimeSpan accessors to get the time in seconds, milliseconds, etc.

Variables

epoch
enum Time epoch;

Represents the epoch (1/1/0001)

epoch1601
enum Time epoch1601;

Represents the epoch of 1/1/1601 (Commonly used in Windows systems)

epoch1970
enum Time epoch1970;

Represents the epoch of 1/1/1970 (Commonly used in Unix systems)

max
enum Time max;

Represents the smallest and largest Time value.

min
enum Time min;

Represents the smallest and largest Time value.

Meta