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)); }