using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KssSmaPlaLib.Commons
{
public static class DateHelperUxer
{
///
/// 指定した年と月の末日を返します。
///
/// 年(例: 2025)
/// 月(1~12)
/// 末日(28~31)
public static bool TryGetLastDayOfMonth(int year, int month, out int matsubi,out string resultMessage)
{
matsubi = -1;
resultMessage = string.Empty;
if (month < 1 || month > 12)
{
resultMessage = "月が1~12の範囲ではありません。";
return false;
}
// DateTime構造体を使って末日を取得
matsubi = DateTime.DaysInMonth(year, month);
return true;
}
}
}