You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
713 B
25 lines
713 B
namespace Common.Util;
|
|
|
|
public class DateUtils
|
|
{
|
|
public static bool IsDateTimeToday(DateTime? dateTime)
|
|
{
|
|
if (dateTime == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
DateTime startOfToday = DateTime.Today;
|
|
DateTime endOfToday = startOfToday.AddDays(1).AddTicks(-1);
|
|
return dateTime >= startOfToday && dateTime <= endOfToday;
|
|
}
|
|
|
|
|
|
/// 获取明天的0.0.0
|
|
public static DateTime GetTomorrowFirst()
|
|
{
|
|
DateTime today = DateTime.Now; // 获取当前时间
|
|
DateTime tomorrow = today.Date.AddDays(1); // 获取明天的日期
|
|
return new DateTime(tomorrow.Year, tomorrow.Month, tomorrow.Day, 0, 0, 0); // 获取明天的0点
|
|
}
|
|
} |