比较两个日期时间的大小

今天写了个小程序里面用到了比较两个日期时间的大小
#include <stdio.h>
#include <iostream.h>
#include <afx.h>

void main()
{
CString str01=“2011-07-11 20:46:21”;
CString str02=“2011-06-11 20:46:22”;
if (str01<str02)
{
cout<<"<"<<endl;
}
else
{
cout<<">"<<endl;
}
}

两个字符串是可以直接比较出来,

如果是零点的时候,怎么办呢,OMG,零点的时候,day已经跳了啊,你管他作甚呢。。。。。。

猜你喜欢

转载自blog.csdn.net/weixin_44825473/article/details/88979005