The rfmtdate() function
The rfmtdate() function uses a formatting mask to convert an internal DATE value to a character string.
Syntax
mint rfmtdate(jdate, fmtstring, outbuf)
int4 jdate;
char *fmtstring;
char *outbuf;
- jdate
- The internal representation of the date to convert.
- fmtstring
- A pointer to a buffer that contains the formatting mask to use for the jdate value.
- outbuf
- A pointer to a buffer to contain the formatted string for the jdate value.
Usage
The fmtstring argument of the rfmtdate() function points to the date-formatting mask, which contains formats that describe how to format the date string.
The examples in the following
table use the formatting mask in fmtstring to convert the integer jdate,
whose value corresponds to December 25, 2006, to a formatted string outbuf.
You must specify one or more fields.
Formatting mask | Formatted result |
---|---|
"mmdd" | 1225 |
"mmddyy" | 122506 |
"ddmmyy" | 251206 |
"yydd" | 0625 |
"yymmdd" | 061225 |
"dd" | 25 |
"yy/mm/dd" | 06/12/25 |
"yy mm dd" | 06 12 25 |
"yy-mm-dd" | 06-12-25 |
"mmm. dd, yyyy" | Dec. 25, 2006 |
"mmm dd yyyy" | Dec 25 2006 |
"yyyy dd mm" | 2006 25 12 |
"mmm dd yyyy" | Dec 25 2006 |
"ddd, mmm. dd, yyyy" | Mon, Dec. 25, 2006 |
"ww mmm. dd, yyyy" | Mon Dec. 25, 2006 |
"(ddd) mmm. dd, yyyy" | (Mon) Dec. 25, 2006 |
"mmyyddmm" | 25061225 |
"" | unpredictable result |
Return values
- 0
- The conversion was successful.
- -1210
- The internal date cannot be converted to month-day-year format.
- -1211
- The program ran out of memory (memory-allocation error).
- -1212
- Format string is NULL or invalid.