Ctime函数 在ACM中的应用 (二)

2014-11-24 03:15:36 · 作者: · 浏览: 1
id )
{
struct tm *newtime;
char tmpbuf[128];
time_t lt1;

time( <1 );//获得当前时间
newtime=localtime(<1);//转换成当地时间

strftime( tmpbuf, 128, "Today is %A, day %d of %B in the year %Y.\n", newtime);
printf(tmpbuf);

return 0;
}

#include
#include

#include
int main( void )
{
struct tm *newtime;
char tmpbuf[128];
time_t lt1;

time( <1 );//获得当前时间
newtime=localtime(<1);//转换成当地时间

strftime( tmpbuf, 128, "Today is %A, day %d of %B in the year %Y.\n", newtime);
printf(tmpbuf);

return 0;
}