随笔-145  评论-173  文章-70  trackbacks-0
MFC为我们提供了CTime类,通过它,可以轻松的获得当前的系统时间,而且,不要以为必须写界面程序才可以使用,有部分的类是可以在控制台普通程序使用的。于是,下面的就是实现代码:

#include 
<afx.h>
#include 
<iostream>
#include 
<string>
using namespace std;

int main()
{
    CTime t 
= CTime::GetCurrentTime();
    CString str;
    str 
= t.Format("%Y-%m-%d %X");
    cout 
<< str << endl;
}

posted on 2010-02-08 21:22 deercoder 阅读(930) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理