The rmdyjul() function
The rmdyjul() function creates an internal DATE from an array of three short integer values that represent month, day, and year.
Syntax
mint rmdyjul(mdy, jdate)
int2 mdy[3];
int4 *jdate;
- mdy
- An array of short integer values, where mdy[0] is the month (1 - 12), mdy[1] is the day (1 - 31), and mdy[2] is the year (1 - 9999).
- jdate
- A pointer to a long integer that receives the internal DATE value for the mdy array.
Usage
You can express the year in full form (2007) or abbreviated form (07).
Return codes
- 0
- The operation was successful.
- -1204
- The mdy[2] variable contains an invalid year.
- -1205
- The mdy[0] variable contains an invalid month.
- -1206
- The mdy[1] variable contains an invalid day.
Example
The demo directory
contains this sample program in the rmdyjul.ec file.
/*
* rmdyjul.ec *
This program converts an array of short integers containing values
for month, day and year into an integer that stores the date in
internal format.
*/
#include <stdio.h>
main()
{
int4 i_date;
mint errnum;
static short mdy_array[3] = { 12, 21, 2007 };
char str_date[15];
printf("RMDYJUL Sample ESQL Program running.\n\n");
/* Convert MDY array into internal format */
if ((errnum = rmdyjul(mdy_array, &i_date)) == 0)
{
rfmtdate(i_date, "mmm dd yyyy", str_date);
printf("Date '%s' converted to internal format\n", str_date);
}
else
printf("rmdyjul() call failed with errnum = %d\n", errnum);
printf("\nRMDYJUL Sample Program over.\n\n");
}
Output
RMDYJUL Sample ESQL Program running.
Date 'Dec 21 2007' converted to internal format
RMDYJUL Sample Program over.