C语言库函数asctime

C语言库函数asctime函数名: asctime功 能:转换日期和时间为ASCII码函数与形参类型:char *asctime(const struct tm *tblock);程序例:#include #include #include int main(void){struct tm t;char str; /* sample loading of tm structure */ t. tm_sec = 1; /* Seconds */t. tm_min = 30; /* Minutes */t. tm_hour = 9; /* Hour */t. tm_mday = 22; /* Day of the Month */t. tm_mon = 11; /* Month */t. tm_year = 56; /* Year - does not include century */t. tm_wday = 4; /* Day of the week */t. tm_yday = 0; /* Does not show in asctime */t. tm_isdst = 0; /* Is Daylight SavTime; does not show in asctime */ /* converts structure to null terminatedstring */ strcpy(str, asctime(&t));printf("%s ", str); return 0;}

以上内容由大学时代综合整理自互联网,实际情况请以官方资料为准。

相关