C# 获取当前月的月初和月末
2021-03-03 09:27
标签:day static end ati 获取 stat turn DDM ddd /// int span = Convert.ToInt32(System.DateTime.Now.Day); C# 获取当前月的月初和月末 标签:day static end ati 获取 stat turn DDM ddd 原文地址:https://www.cnblogs.com/fhrfhr/p/12986494.html
/// 获取当前月的月末日期
///
///
public static DateTime getEndMonth()
{
System.DateTime dateEnd = System.DateTime.Now.AddMonths(1).AddDays(-span);
return dateEnd ;
}
///
/// 获取当前月初日期
///
///
public static DateTime getStartMonth()
{
int span = Convert.ToInt32(System.DateTime.Now.Day);
span = span - 1;
System.DateTime dateStart = System.DateTime.Now.AddDays(-span);
return dateStart ;
}