Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kDateTime Struct Reference

Description

Represents UTC calendar date/time.

kDateTime is a type alias for a 64-bit signed integer that represents the number of elapsed microseconds since 00:00:00 Jan 1, 1 CE, UTC, excluding leap seconds.

Methods are provided for converting to/from broken-down local time. Support is also provided to format/parse date-time values to/from a small number of different text representations.

kText64 nowText;
kCheck(kDateTime_Format(now, kDATE_TIME_FORMAT_FULL, nowText, sizeof(nowText)));
kLogf("Current date-time: %s", nowText);
kDateTime oneWeekLater = now + kTimeSpan_FromDays64s(7);
k32s monthOneWeekFromNow;
kCheck(kDateTime_LocalParts(oneWeekLater, kNULL, &monthOneWeekFromNow, kNULL, kNULL, kNULL, kNULL, kNULL, kNULL, kNULL));
kLogf("Month, one week from now: %d", monthOneWeekFromNow);

kDateTime supports the kdat6 serialization protocol.

kDateTime overrides kValue_Equals and kValue_HashCode.

Inheritance diagram for kDateTime:
Inheritance graph

Related

kStatus kDateTime_Format (kDateTime dateTime, kDateTimeFormat format, kChar *text, kSize capacity)
 Formats a date-time value as a string. More...
 
kStatus kDateTime_FromLocalParts (kDateTime *dateTime, k32s year, k32s month, k32s day, k32s hour, k32s minute, k32s second, k32s microsecond, k32s utcOffset)
 Gets the date-time value associated with the specified broken-down local time parts. More...
 
kStatus kDateTime_LocalParts (kDateTime dateTime, k32s *year, k32s *month, k32s *day, k32s *dayOfWeek, k32s *hour, k32s *minute, k32s *second, k32s *microsecond, k32s *utcOffset)
 Gets the broken-down local time associated with a date-time value. More...
 
kDateTime kDateTime_Now ()
 Gets the current calendar date-time. More...
 
kStatus kDateTime_Parse (kDateTime *dateTime, kDateTimeFormat format, const kChar *text)
 Parses a time string that was formatted with kDateTime_Format. More...
 

Additional Inherited Members

- Public Member Functions inherited from kValue
kBool kValue_Equals (kType type, const void *value, const void *other)
 Determines whether a value is equal to another value. More...
 
kSize kValue_HashCode (kType type, const void *value)
 Gets a hash code representing the state of this value. More...
 
void kValue_Import (kType type, void *value, const void *source)
 Imports the content of another value into this value. More...
 
- Protected Member Functions inherited from kValue
kBool kValue_VEquals (kType type, const void *value, const void *other)
 Protected virtual method that compares two values for equality. More...
 
kSize kValue_VHashCode (kType type, const void *value)
 Protected virtual method that calculates a hash code representing the value instance. More...
 
void kValue_VImport (kType type, void *value, const void *source)
 Protected virtual method that imports data from an external source into an array-value type. More...
 

The documentation for this struct was generated from the following file: