第1个回答 推荐于2016-04-16
C/C++ code
#include <stdio.h>
#include <time.h>
int main(void)
{
time_t tick;
struct tm tm;
char s[100];
tick = time(NULL);
tm = *localtime(&tick);
strftime(s, sizeof(s), "%Y-%m-%d %H:%M:%S", &tm);
printf("%d: %s\n", (int)tick, s);
return 0;
}本回答被提问者和网友采纳