/// <summary>
/// 获取指定年月的第一天
/// </summary>
/// <param name="dt">日期</param>
/// <returns></returns>
public static DateTime GetCurMonthFirstDay(DateTime dt)
{
DateTime AssemblDate = Convert.ToDateTime(dt.Year + "-" + dt.Month + "-" + "01");
return AssemblDate.AddDays(1 - AssemblDate.Day);
}
/// <summary>
/// 获取指定年月的最后一天
/// </summary>
/// <param name="dt">日期</param>
/// <returns></returns>
public static DateTime GetCurMonthLastDay(DateTime dt)
{
DateTime AssemblDate = Convert.ToDateTime(dt.Year + "-" + dt.Month + "-" + "01");
return AssemblDate.AddDays(1 - AssemblDate.Day).AddMonths(1).AddDays(-1);
}
最后修改:2023 年 02 月 15 日
© 允许规范转载