The rjulmdy() function

The rjulmdy() function creates an array of three short integer values that represent the month, day, and year from an internal DATE value.

Syntax

mint rjulmdy(jdate, mdy)
   int4 jdate;
   int2 mdy[3];
jdate
The internal representation of the date.
mdy
An array of short integers, where mdy[0] is the month (1 - 12), mdy[1] is the day (1 - 31), and mdy[2] is the year (1 - 9999).

Return codes

0
The operation was successful.
< 0
The operation failed.
-1210
The internal date could not be converted to the character string format.

Example

The demo directory contains this sample program in the rjulmdy.ec file.
/*
   * rjulmdy.ec *

   The following program accepts a date entered from the console and converts 
   it to an array of three short integers that contain the month, day, and year. 
*/

#include <stdio.h>

main()
{
   int4 i_date;
   short mdy_array[3];
   mint errnum;
   char date[20];
   mint x;

   static char fmtstr[9] = "mmddyyyy";

   printf("RJULMDY Sample ESQL Program running.\n\n");

   /* Allow user to enter a date */
   printf("Enter a date as a single string, month.day.year\n");
   gets(date);

   printf("\nThe date string is %s.\n", date);

   /* Put entered date in internal format */
   if (x = rdefmtdate(&i_date, fmtstr, date))
      printf("Error %d on rdefmtdate conversion\n", x);
   else
      {

   /* Convert from internal format to MDY array */
      if ((errnum = rjulmdy(i_date, mdy_array)) == 0)
         {
         printf("\tThe month component is: %d\n", mdy_array[0]);
         printf("\tThe  day  component is: %d\n", mdy_array[1]);
         printf("\tThe year  component is: %d\n", mdy_array[2]);
         }
      else
         printf("rjulmdy() call failed with error %d", errnum);
      }

    printf("\nRJULMDY Sample Program over.\n\n");
}

Output

RJULMDY Sample ESQL Program running.

Enter a date as a single string, month.day.year
10.12.07

The date string is 10.12.07.
The month component is: 10
The day component is: 12
The year component is: 2007

RJULMDY Sample Program over.