You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.6 KiB
C++

#include "StdAfx.h"
#include "ValStrDate.h"
CValStrDate::CValStrDate(void)
{
m_DateType = _DATE_YEAR_FOUR;
m_ValStrType = _STR_DATE;
}
CValStrDate::~CValStrDate(void)
{
}
CString CValStrDate::GetTypeStr()
{
return "Date";
}
CString CValStrDate::GetStr()
{
//获取当前系统时间
CTime tm; tm=CTime::GetCurrentTime();
CString str;
switch(m_DateType)
{
case _DATE_YEAR_FOUR:
str = tm.Format("20%y");
break;
case _DATE_YEAR_TWO:
str = tm.Format("%y");
break;
case _DATE_MONTH:
str = tm.Format("%m");
break;
case _DATE_DAY:
str = tm.Format("%d");
break;
case _DATE_DAY_IN_YEAR:
break;
case _DATE_WEEK:
str = tm.Format("%w");
break;
case _DATE_WEEK_IN_YEAR:
break;
default:
break;
}
//左边补0
AddLeftZreo(str);
return str;
}
CString CValStrDate::GetDateTypeStr()
{
CString str;
switch(m_DateType)
{
case _DATE_YEAR_FOUR:
case _DATE_YEAR_TWO:
str = "";
break;
case _DATE_MONTH:
str = "";
break;
case _DATE_DAY:
str = "";
break;
case _DATE_DAY_IN_YEAR:
str = "";
break;
case _DATE_WEEK:
str = "星期";
break;
case _DATE_WEEK_IN_YEAR:
str = "";
break;
default:
break;
}
return str;
}