informix
INFORMIX-ESQL/C Programmer's Manual
ESQL/C Function Library

rfmtdate()

The rfmtdate() function uses a formatting mask to convert an internal DATE format to a character string.

Syntax

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. For more information on these date formats, see Formatting Numeric Strings.

The examples in the following table use the formatting mask in fmtstring to convert the integer jdate, whose value corresponds to December 25, 1995, to a formatted string outbuf. You must specify one or more fields.

Formatting Mask Formatted Result
"mmdd" 1225
"mmddyy" 122595
"ddmmyy" 251295
"yydd" 9525
"yymmdd" 951225
"dd" 25
"yy/mm/dd" 95/12/25
"yy mm dd" 95 12 25
"yy-mm-dd" 95-12-25
"mmm. dd, yyyy" Dec. 25, 1995
"mmm dd yyyy" Dec 25 1995
"yyyy dd mm" 1995 25 12
"mmm dd yyyy" Dec 25 1995
"ddd, mmm. dd, yyyy" Mon, Dec. 25, 1995
"ww mmm. dd, yyyy" Mon Dec. 25, 1995
"(ddd) mmm. dd, yyyy" (Mon) Dec. 25, 1995
"mmyyddmm" 25951225
"" unpredictable result

When you use a nondefault locale whose dates contain eras, you can use extended-format strings in the fmtstring argument of rfmtdate(). For more information, see the Informix Guide to GLS Functionality.

Return Codes

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.

Example

The demo directory contains this sample program in the rfmtdate.ec file.

Output


INFORMIX-ESQL/C Programmer's Manual, Version 9.21
Copyright © 1999, Informix Software, Inc. All rights reserved