Quartz.Net系列(十三):DateBuilder中的API详解

1.DateOf、ToDayAt、TomorrowAt

DateOf:指定年月日时分秒

public static DateTimeOffset DateOf(int hour, int minute, int second) { ValidateSecond(second); ValidateMinute(minute); ValidateHour(hour); DateTimeOffset c = SystemTime.Now(); DateTime dt = new DateTime(c.Year, c.Month, c.Day, hour, minute, second); return new DateTimeOffset(dt, TimeZoneUtil.GetUtcOffset(dt, TimeZoneInfo.Local)); } public static DateTimeOffset DateOf(int hour, int minute, int second, int dayOfMonth, int month) { ValidateSecond(second); ValidateMinute(minute); ValidateHour(hour); ValidateDayOfMonth(dayOfMonth); ValidateMonth(month); DateTimeOffset c = SystemTime.Now(); DateTime dt = new DateTime(c.Year, month, dayOfMonth, hour, minute, second); return new DateTimeOffset(dt, TimeZoneUtil.GetUtcOffset(dt, TimeZoneInfo.Local)); } public static DateTimeOffset DateOf(int hour, int minute, int second, int dayOfMonth, int month, int year) { ValidateSecond(second); ValidateMinute(minute); ValidateHour(hour); ValidateDayOfMonth(dayOfMonth); ValidateMonth(month); ValidateYear(year); DateTime dt = new DateTime(year, month, dayOfMonth, hour, minute, second); return new DateTimeOffset(dt, TimeZoneUtil.GetUtcOffset(dt, TimeZoneInfo.Local)); }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zywpyp.html