Files
HLib/Commons/DateHelperUxer.cs
T
2026-06-01 13:23:34 +09:00

36 lines
1002 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KssSmaPlaLib.Commons
{
public static class DateHelperUxer
{
/// <summary>
/// 指定した年と月の末日を返します。
/// </summary>
/// <param name="year">年(例: 2025</param>
/// <param name="month">月(112</param>
/// <returns>末日(2831</returns>
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;
}
}
}