C++ 如何从系统获取当前时间,要年月日,不要小时,分钟,秒的。

[复制链接]
查看11 | 回复3 | 2011-4-30 22:19:31 | 显示全部楼层 |阅读模式
CTime m_currentTime=CTime::GetCurrentTime(); int m_year; int m_month; int m_day; char CurrentTime[128]; m_year=m_currentTime.GetYear(); m_month=m_currentTime.GetMonth(); m_day=m_currentTime.GetDay(); sprintf(CurrentTime,"%04d年%02d月%02d日",m_year,m_month,m_day);
回复

使用道具 举报

千问 | 2011-4-30 22:19:31 | 显示全部楼层
#include#include#includeusing namespace std;int getSystemTime() {time_t timer;time(&timer);tm* t_tm = localtime(&timer); co
回复

使用道具 举报

千问 | 2011-4-30 22:19:31 | 显示全部楼层
CTime类有一个静态函数GetCurrentTime();然后使用Format
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行