Riverside Learning LABO(Skill/Idea/Code)

よりよいシステムのため工学系と人間系の学習下書きメモ

the end of the month

『月末を取得する』メモ

static const short int dDayMax[] = {
0 /* ダミー */,
31 /* 1月 */, 28 /* 2月 */, 31 /* 3月 */, 30 /* 4月 */,
31 /* 5月 */, 30 /* 6月 */, 31 /* 7月 */, 31 /* 8月 */,
30 /* 9月 */, 31 /* 10月 */, 30 /* 11月 */, 31 /* 12月 */,
};

//うるう年を判定する
*p1*pDay = dDayMax[*pMonth];
if (*pMonth == 2) {
 if (*pYear % 400 == 0 || (*pYear % 100 != 0 && *pYear % 4 == 0)) {
  *pDay = 29;
 }
}