获取时间的各种方法

CString格式:

CTime m_time;  
m_time = CTime::GetCurrentTime();//获取当前时间日期  
CString m_strDateTime = m_time.Format(_T("%Y-%m-%d %H:%M:%S "));//格式化日期时间

string格式:

std::string IconRecognizeImp::getTime()
{
	time_t timep;
	time (&timep);
	char tmp[64];
	strftime(tmp, sizeof(tmp), "%Y-%m-%d %H:%M:%S   ",localtime(&timep) );
	return tmp;
}

猜你喜欢

转载自blog.csdn.net/liminwang0311/article/details/80251469