The rtoday() function
The rtoday() function returns the system date as a long integer value.
Syntax
void rtoday(today)
int4 *today;
- today
- A pointer to an int4 value that receives the internal DATE.
Usage
The rtoday() function obtains the system date on the client computer, not the server computer.
Example
The demo directory
contains this sample program in the rtoday.ec file.
/*
* rtoday.ec *
The following program obtains today's date from the system,
converts it to ASCII using rdatestr(), and displays the result.
*/
#include <stdio.h>
main()
{
mint errnum;
char today_date[20];
int4 i_date;
printf("RTODAY Sample ESQL Program running.\n\n");
/* Get today's date in the internal format */
rtoday(&i_date);
/* Convert date from internal format into a mm/dd/yyyy string */
if ((errnum = rdatestr(i_date, today_date)) == 0)
printf("\n\tToday's date is %s.\n", today_date);
else
printf("\n\tError %d in converting date to mm/dd/yyyy\n", errnum);
printf("\nRTODAY Sample Program over.\n\n");
}
Output
RTODAY Sample ESQL Program running.
Today's date is 09/16/2007.
RTODAY Sample Program over.