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.

98 lines
2.0 KiB
C++

#include "StdAfx.h"
#include "ValStrTime.h"
CValStrTime::CValStrTime(void)
{
m_TimeType = _TIME_HOUR_24;
m_ValStrType = _STR_TIME;
}
CValStrTime::~CValStrTime(void)
{
}
CString CValStrTime::GetTypeStr()
{
return "Time";
}
CString CValStrTime::GetStr()
{
//<2F><>ȡ<EFBFBD><C8A1>ǰϵͳʱ<CDB3><CAB1>
CTime tm; tm=CTime::GetCurrentTime();
int time;
CString str;
switch(m_TimeType)
{
case _TIME_HOUR_24:
time = tm.GetHour();
str.Format("%ld",time);
break;
case _TIME_HOUR_12:
time = tm.GetHour();
str.Format("%ld",time%12);
break;
case _TIME_MINUTE:
time = tm.GetMinute();
str.Format("%ld",time);
break;
case _TIME_SECOND:
time = tm.GetSecond();
str.Format("%ld",time);
break;
case _TIME_AM_OR_PM_1:
time = tm.GetHour();
if(time>=12)
{
str = "PM";
}
else
{
str = "AM";
}
break;
case _TIME_AM_OR_PM_2:
time = tm.GetHour();
if(time>=12)
{
str = "pm";
}
else
{
str = "am";
}
break;
default:
break;
}
//<2F><><EFBFBD>߲<EFBFBD>0
AddLeftZreo(str);
return str;
}
CString CValStrTime::GetTimeTypeStr()
{
CString str;
switch(m_TimeType)
{
case _TIME_HOUR_24:
str = "Сʱ- 24";
break;
case _TIME_HOUR_12:
str = "Сʱ- 12";
break;
case _TIME_MINUTE:
str = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
break;
case _TIME_SECOND:
str = "<EFBFBD><EFBFBD>";
break;
case _TIME_AM_OR_PM_1:
str = "ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(AM,PM)";
break;
case _TIME_AM_OR_PM_2:
str = "ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(am,pm)";
break;
default:
break;
}
return str;
}