기본카테고리

[C++]GetLastDayOfMonth

DevReff 2013. 4. 17. 12:58




728x90

int Date::GetLastDayOfMonth()
{
int days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int isLeapYear = 0;
if( m_year % 4 == 0 )
{
isLeapYear = 1;
if( m_year % 100 == 0 )
{
isLeapYear = 0;
if( m_year % 400 == 0 )
isLeapYear = 1;
}
} days[1] += isLeapYear; return days[m_month-1]; }