#include <time.h>
#include <stdlib.h>
char *pszCurrTime = (char*)malloc(sizeof(char)*20);
memset(pszCurrTime, 0, sizeof(char)*20);
time_t now;
time(&now);
strftime(pszCurrTime, 20 , "%Y/%m/%d %H:%M:%S", localtime(&now));
时间格式即为 2011/07/08 11:13:44