The encodeDate (struct tm Values) function

Converts a struct tm value to a Netezza Performance Server-encoded Date. The function uses tm.tm_year, tm.tm_mon and tm.tm_day fields of date only, and ignores the other fields. The date value should pass the isValidTimeStruct boolean test, but it is not a requirement.

Description

The function has the following syntax:
inline void encodeDate(const struct tm& date, int32* encodedDate, 
bool* errorFlag = NULL)

date specifies the struct tm date value.

encodedDate specifies the parameter in which to record the Date that is encoded in Netezza Performance Server format.

errorFlag is an optional argument. If not NULL, it is set to true if date.tm_mon<0 or date.tm_mday<1 or date.tm_year+1900<SQL_YEAR_MIN or isValidDate(date.tm_mon+1, date.tm_mday, date.tm_year) is false. Otherwise, it is set to false.

Throws

The function throws an opaque exception object if &date is NULL or encodedDate is NULL or (errorFlag is NULL and (isValidDate(date.tm_mon+1, date.tm_mday,

date.tm_year+1900) is false or date.tm_mon<0 or date.tm_mday<1 or date.tm_year+1900<SQL_YEAR_MIN)).