void TimeScreen(CString TimeYear, CString TimeMonth, CString TimeDate) //分割好的年月日按顺序存入函数
{
TRACE("%s-%s-%s", TimeYear, TimeMonth, TimeDate);
CString Jan1 = "Jan", Feb2 = "Feb", Mar3 = "Mar", Apr4 = "Apr", May5 = "May",
June6 = "June", July7 = "July", Aug8 = "Aug", Sept9 = "Sept", Oct10 = "Oct", Nov11 = "Nov", Dec12 = "Dec";
COleDateTime ole_time;
int MonthInt = 0;
switch (1) //什么条件
{
case 1:
if (TimeMonth == Jan1)
{
MonthInt = _ttoi("1");
break;
}
//一月Jan
case 2:
if (TimeMonth == Feb2)
{
MonthInt = _ttoi("2");
break;
}
//二月Feb
case 3:
if (TimeMonth == Mar3)
{
MonthInt = _ttoi("3");
break;
}
//三月Mar
case 4:
if (TimeMonth == Apr4)
{
MonthInt = _ttoi("4");
break;
}
//四月Apr
case 5:
if (TimeMonth == May5)
{
MonthInt = _ttoi("5");
break;
}
//五月May
case 6:
if (TimeMonth == June6)
{
MonthInt = _ttoi("6");
break;
}
//六月June
case 7:
if (TimeMonth == July7)
{
MonthInt = _ttoi("7");
break;
}
//七月July
case 8:
if (TimeMonth == Aug8)
{
MonthInt = _ttoi("8");
break;
}
//八月Aug
case 9:
if (TimeMonth == Sept9)
{
MonthInt = _ttoi("9");
break;
}
//九月Sept
case 10:
if (TimeMonth == Oct10)
{
MonthInt = _ttoi("10");
break;
}
//十月Oct
case 11:
if (TimeMonth == Nov11)
{
MonthInt = _ttoi("11");
break;
}
//十一月Nov
case 12:
if (TimeMonth == Dec12)
{
MonthInt = _ttoi("12");
break;
}
//十二月Dec;
default:
break;
}
//问题一。还是要带0的需要把CString转换成CTime
FileTime.Format("%s-%d-%s", TimeYear, MonthInt, TimeDate);
ole_time.ParseDateTime(FileTime);
FileTime = ole_time.Format("%Y-%m-%d");
return ;
}
敲的好累留备份日后复制拿着用