Timestamp

Timestamp

Note: The component values in the binary encoding are always in UTC, while components in the text encoding are in the local time! This means that transcoding requires a conversion between UTC and local time.

Timestamp precision is up to picosecond (second/10^12).

struct Timestamp {}

Constructors

this
this(const(char)[] str)
this
this(short year)
this
this(short year, ubyte month)
this
this(short year, ubyte month, ubyte day)
this
this(short year, ubyte month, ubyte day, ubyte hour, ubyte minute)
this
this(short year, ubyte month, ubyte day, ubyte hour, ubyte minute, ubyte second)
this
this(short year, ubyte month, ubyte day, ubyte hour, ubyte minute, ubyte second, byte fractionExponent, ulong fractionCoefficient)
this
this(Date datetime)
this
this(TimeOfDay timeOfDay)
this
this(DateTime datetime)
this
this(SysTime systime)

Members

Aliases

fromISOExtString
alias fromISOExtString = fromISOStringImpl!true

Creates a Timestamp from a string with the format YYYY-MM-DDThh:mm:ss±hh:mm or its leading part allowed by the standard.

fromISOString
alias fromISOString = fromISOStringImpl!false

Creates a Timestamp from a string with the format `YYYYMMDDThhmmss±hhmm or its leading part allowed by the standard.

toISOExtString
alias toISOExtString = toISOStringImp!true

Converts this Timestamp to a string with the format YYYY-MM-DDThh:mm:ss±hh:mm.

toISOString
alias toISOString = toISOStringImp!false

Converts this Timestamp to a string with the format YYYYMMDDThhmmss±hhmm.

toString
alias toString = toISOExtString

Converts this Timestamp to a string with the format YYYY-MM-DDThh:mm:ss±hh:mm.

Enums

Precision
enum Precision

Functions

addMinutes
void addMinutes(short minutes)

Helpfer for time zone offsets

hasOffset
bool hasOffset()
isOnlyTime
bool isOnlyTime()
offset
short offset()

Timezone offset in minutes

opCast
T opCast()
opCmp
int opCmp(Timestamp rhs)
withOffset
Timestamp withOffset(short minutes)

Attaches local offset, doesn't adjust other fields. Local-time offsets may be represented as either hour*60+minute offsets from UTC, or as the zero to denote a local time of UTC. They are required on timestamps with time and are not allowed on date values.

Static functions

fromString
bool fromString(const(C)[] str, Timestamp value)
Timestamp fromString(const(C)[] str)

Creates a Timestamp from a string with the format YYYY-MM-DD, YYYYMMDD, or YYYY-Mon-DD.

onlyTime
Timestamp onlyTime(ubyte hour, ubyte minute)
onlyTime
Timestamp onlyTime(ubyte hour, ubyte minute, ubyte second)
onlyTime
Timestamp onlyTime(ubyte hour, ubyte minute, ubyte second, byte fractionExponent, ulong fractionCoefficient)

Templates

fromISOStringImpl
template fromISOStringImpl(bool ext)
Undocumented in source.
toISOStringImp
template toISOStringImp(bool ext)
Undocumented in source.

Variables

day
ubyte day;

Day

fractionCoefficient
long fractionCoefficient;

Fraction

fractionExponent
byte fractionExponent;

Fraction

hour
ubyte hour;

Hour

minute
ubyte minute;

Minute

month
ubyte month;

Month

offset
short offset;
Undocumented in source.
precision
Precision precision;
second
ubyte second;

Second

year
short year;

Year

Meta