程序1:
#include
#include
void main ()
{
time_t T;
struct tm * timenow;
time ( &T );
timenow = localtime ( &T );
printf ( "现在时间是: %s", asctime (timenow) );
}
程序2:
/*****本程序由Microsoft Visual C++ 6.0运行通过*****/
#include
#include
void main()
{
char time[128];
_tzset();
_strtime(time);
printf("time:\t%s\n", time);
_strdate(time);
printf("date:\t%s\n",time);
}
程序3:
#include
#include
int main()
{
time_t ltime;
char tmpbuf[128];
time(<ime);
printf(ctime(<ime) );
return 0;
}
程序4:
#include
#include
int main()
{
time_t t = time(0);
char tmp[64];
strftime(tmp,sizeof(tmp),"%Y/%m/%d %X %A 本年第%j天 %z",localtime(&t));
puts(tmp);
return 0;
}