为什么CTime::GetCUrrentTime()得到不是本地时间? 不是电脑的时间,而是1970年 ,只要具体回答的 ,就给满分!
解决方案 »
- 从编辑框派生了一个类,在单击编辑框是弹出个对话框,我做的弹出来的是个非模态对话框,问题是会重复弹出好多个,我不知道该怎么做了,有谁可以帮帮忙?
- 同一个单位下X方向的像素和Y方向的像素相等嘛?
- 同一个程序在不同的系统上进程ID一样吗?
- 请教继承自CDialog的对话框应用程序从最小化到最大化调用了哪个消息函数?
- UP有分!!!请问如何在MFC应用程序捕获com中的事件通知(最好有例子)?
- 如何恢复一个已经最小化的窗口?
- 请问在vc里怎样用ado方法来定位一条数据纪录,希望有源码。
- 用CFile和CStdioFile类的方法读取数据文件时,文件一大,就出错,什么原因?
- EditBox的ON_EN_CHANGE消息问题,帮忙看一下
- 非MFC的DLL窗口函数 为什么WndProc收不到消息..?
- MFC关于添加按钮图标问题(CBitmapButton::AutoLoad)
- BST_INDETERMINATE//怎么用呀?
CString strRecordTime = tRecordTime.Format("%Y-%m-%d %H:%M:%S");
MessageBox(strRecordTime);
Returns the current system date and time in Coordinated Universal Time (UTC).
CTime::GetCurrentTime COleDateTime::GetCurrentTime 返回的是本地当前时间
time = COleDateTime::GetCurrentTime();
sprintf(filename,"%s%s.log",szLogFile,time.Format("%Y%m%d").GetBuffer(0));这个就是当前时间的。一直都这么用没有问题....
CTime::GetCurrentTime 得到的就是本地时间啊..
CTime t = CTime::GetCurrentTime;
CString str;
str.Format("%04d/%02d/%02d %02d:%02d:%02d",t.GetYear(),t.GetMonth,t.GetDay,t.GetHour,t.GetMinute,t.GetSec);
{
shijian.GetCurrentTime();
CString s;
s=shijiana.Format("%d");
m_shijian=s;
MESSAGEBox(s,"kaishishijian");
}
{
shijian.GetCurrentTime();
CString s;
s=shijiana.Format("%d");
m_shijian=s;
MESSAGEBox(s,"kaishishijian");
}
调试得到的错误:
error :expression connot be evaluated
GetCurrentTime是静态函数,直接::调用CTime t=CTime::GetCurrentTime();
CString s=t.Format( "%Y ");