vc获取系统日期

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

参考:http://blog.sina.com.cn/s/blog_622bd1660100n53r.html

posted @ 2012-03-06 10:23  good90  阅读(352)  评论(0编辑  收藏  举报