ESQL/C functions for date conversion
The IBM® Informix® ESQL/C function library provides functions to convert a DATE (mi_date) value to and from char strings.
Function name | Description |
---|---|
rdatestr() | Converts an internal format to string |
rdefmtdate() | Converts a string to an internal format using a formatting mask |
rfmtdate() | Converts an internal format to a string using a formatting mask |
rstrdate() | Converts a string to an internal format |
The rdatestr() and rstrdate() functions convert mi_date values to and from a date string that is formatted with the DBDATE environment variable.
These functions also examine the GL_DATE environment variable for the format of the date string. When you use a nondefault locale and do not set the DBDATE or GL_DATE environment variable, rdatestr() uses the date end-user format that the client locale defines. For more information, see the HCL Informix GLS User's Guide.
- dd
- Day of the month as a two-digit number (01 - 31)
- ddd
- Day of the week as a three-letter abbreviation (Sun through Sat)
- mm
- Month as a two-digit number (01 - 12)
- mmm
- Month as a three-letter abbreviation (Jan through Dec)
- yy
- Year as a two-digit number in the 1900s (00 - 99)
- yyyy
- Year as a four-digit number (0001 - 9999)
Any other characters in the formatting mask are reproduced literally in the result.
When you use a nondefault locale whose dates contain eras, you can use extended-format strings in a numeric-formatting mask.
When you use rfmtdate() or rdefmtdate() to format DATE values, the function uses the date end-user formats that the GL_DATE or DBDATE environment variable specifies. If neither of these environment variables is set, these date-formatting functions use the date end-user formats for the locale. The default locale, US English, uses the format mm/dd/yyyy. For a discussion of GL_DATE and DBDATE, see the HCL Informix GLS User's Guide.