直接上代码
#include#include int main(){ time_t tmpcal_t; struct tm *tmp_ptr = NULL; time(&tmpcal_t); tmp_ptr = localtime(&tmpcal_t); printf ("the time is:%d.%d.%d ", (1900+tmp_ptr->tm_year), (1+tmp_ptr->tm_mon), tmp_ptr->tm_mday); printf("%d:%d:%dn", tmp_ptr->tm_hour, tmp_ptr->tm_min, tmp_ptr->tm_sec); }



