안녕하세요. MFC에서 날짜(년,월,일)이 정상인지 확인해주는 함수가 있을까요? 년(2바이트), 월(1바이트), 일(1바이트)의 정보로, (인수형식은 아무거나 상관없습니다) 해당 날짜가 존재하는지 확인할 수 있는 클래스멤버함수가 있을까요?
감사드립니다!
int year, month, day; CString strYear, strMonth, strDay; m_year.GetWindowText(strYear); m_month.GetWindowText(strMonth); m_day.GetWindowText(strDay); year = _ttoi(strYear); month = _ttoi(strMonth); day = _ttoi(strDay); COleDateTime checkDate(year, month, day, 0, 0, 0); if(checkDate.GetStatus() == 0) { AfxMessageBox("Valid Date"); } else { AfxMessageBox("Not Valid Date!"); }
더 좋은 방법이 있으면 알려주세요.
어떻게 대충 해결했습니다.
int year, month, day; CString strYear, strMonth, strDay; m_year.GetWindowText(strYear); m_month.GetWindowText(strMonth); m_day.GetWindowText(strDay); year = _ttoi(strYear); month = _ttoi(strMonth); day = _ttoi(strDay); COleDateTime checkDate(year, month, day, 0, 0, 0); if(checkDate.GetStatus() == 0) { AfxMessageBox("Valid Date"); } else { AfxMessageBox("Not Valid Date!"); }더 좋은 방법이 있으면 알려주세요.