文件抓取时间对比-笔记MFC

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 ;
}

敲的好累留备份日后复制拿着用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值