Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Convert a packed CTDATETIME into a string including milliseconds.



DateType, CTTIME_TYPE TimeType, pTEXT pStr, VRLEN size)


ctdbDateTimeToString() converts a packed CTDATETIME into a string. The date is converted to string based on the DateType parameter, and the time is converted to string based on the TimeType parameter.

  • DateTime [in] the date and time, in CTDATETIME format.
  • DateType [in] the date type. Valid types are listed in c-treeDB API Data Types.
  • TimeType [in] the time type. Valid types are listed inc-treeDB API Data Types.
  • pStr [out] a pointer to the string that will result from the conversion.
  • size [in] the buffer size for the string.

This function supports the CTTIME_HHMST mode, which forces the hour to be two digits and returns time as hh:mm:ss.ttt (24 hour).


ctdbDateTimeToString() returns CTDBRET_OK on success, or c-treeDB API error on failure.

The possible errors associated with ctdbDateTimeToString() are:

  • CTDBRET_NULARG (4007): Null argument not valid in pStr
  • CTDBRET_INVDATE (4029): Invalid format in DateType
  • CTDBRET_INVTYPE (4019): Invalid type in DateType or TimeType
  • CTDBRET_ARGSMALL (4006): Buffer is too small (increase size)

See also

ctdbTimeToString(), ctdbDateToString(), ctdbStringToDateTime()