1、
1 CString m_time;
2 CTime theCurrentTime = CTime::GetCurrentTime();
3 m_time = theCurrentTime.Format("%Y-%m-%d");
2、
1 struct tm *t;
2 time_t tt;
3 time(&tt);
4 t=localtime(&tt);
5 printf("%d-%d-%d\n",t->tm_year+1900,t->tm_mon+1,t->tm_mday);
author:good90