rtoday() 函数返回系统日期作为 long integer 值。
语法
void rtoday(today)
int4 *today;
today
指向接收内部 DATE 的 int4 值的指针。
用法
rtoday() 函数取得客户机计算机上的系统日期,而不是服务器计算机上的。
示例
demo 目录在 rtoday.ec 文件中包含此样例程序。
/*
* rtoday.ec *
The following program obtains today's date from the system,
converts it to ASCII using rdatestr(), and displays the result.
*/
#include
main()
{
mint errnum;
GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 909 -
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");
}
输出
RTODAY Sample ESQL Program running.
Today's date is 09/16/2007.
RTODAY Sample Program over.