TTm TTm::GetTmFromWebLogTimeStr(const TStr& TimeStr, const char TimeSepCh, const char MSecSepCh){ int TimeStrLen=TimeStr.Len(); // year TChA ChA; int ChN=0; while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=TimeSepCh)){ ChA+=TimeStr[ChN]; ChN++;} TStr HourStr=ChA; // minute ChA.Clr(); ChN++; while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=TimeSepCh)){ ChA+=TimeStr[ChN]; ChN++;} TStr MinStr=ChA; // second ChA.Clr(); ChN++; while ((ChN<TimeStrLen)&&(TimeStr[ChN]!=MSecSepCh)){ ChA+=TimeStr[ChN]; ChN++;} TStr SecStr=ChA; // mili-second ChA.Clr(); ChN++; while (ChN<TimeStrLen){ ChA+=TimeStr[ChN]; ChN++;} TStr MSecStr=ChA; // transform to numbers int HourN=HourStr.GetInt(0); int MinN=MinStr.GetInt(0); int SecN=SecStr.GetInt(0); int MSecN=MSecStr.GetInt(0); // construct time TTm Tm(-1, -1, -1, -1, HourN, MinN, SecN, MSecN); // return time return Tm; }
void CFoodMenuDlg::SetDateLabel() { UpdateData(TRUE); SYSTEMTIME stDate; m_FoodMenuDateCtrl.GetTime(&stDate); DWORD nYYYY = stDate.wYear; DWORD nMM = stDate.wMonth; DWORD nDD = stDate.wDay; m_strDate11.Format("%d%0.2d%0.2d", nYYYY, nMM, nDD); m_strDate12 = m_strDate11 ; //m_strDate12 += " 석식"; //m_strDate11 += " 중식"; CTimeSpan tSp1(1,0,0,0); CTimeSpan tSp2(2,0,0,0); CTimeSpan tSp3(3,0,0,0); CTimeSpan tSp4(4,0,0,0); CTime Tm(stDate); CTime TmpTm2 = Tm + tSp1 ; m_strDate21.Format("%d%0.2d%0.2d", TmpTm2.GetYear(), TmpTm2.GetMonth(), TmpTm2.GetDay()); m_strDate22 = m_strDate21; //m_strDate22 += " 석식"; //m_strDate21 += " 중식"; CTime TmpTm3 = Tm + tSp2 ; m_strDate31.Format("%d%0.2d%0.2d", TmpTm3.GetYear(), TmpTm3.GetMonth(), TmpTm3.GetDay()); m_strDate32 = m_strDate31; //m_strDate32 += " 석식"; //m_strDate31 += " 중식"; CTime TmpTm4 = Tm + tSp3 ; m_strDate41.Format("%d%0.2d%0.2d", TmpTm4.GetYear(), TmpTm4.GetMonth(), TmpTm4.GetDay()); m_strDate42 = m_strDate41; //m_strDate42 += " 석식"; //m_strDate41 += " 중식"; CTime TmpTm5 = Tm + tSp4 ; m_strDate51.Format("%d%0.2d%0.2d", TmpTm5.GetYear(), TmpTm5.GetMonth(), TmpTm5.GetDay()); m_strDate52 = m_strDate51; //m_strDate52 += " 석식"; //m_strDate51 += " 중식"; UpdateData(FALSE); }