1
我試圖添加添加日程安排開始日期時間和日程安排結束日期使用ConTrigger的時間是可以在Quartz.net?是否可以使用ConTrigger添加計劃開始日期時間和計劃結束日期時間?
我試圖添加添加日程安排開始日期時間和日程安排結束日期使用ConTrigger的時間是可以在Quartz.net?是否可以使用ConTrigger添加計劃開始日期時間和計劃結束日期時間?
是的,這是由CronTrigger支持的。 CronTriggerImpl有一個構造函數,允許你這樣做:
/// <summary>
/// Create a <see cref="CronTriggerImpl" /> with fire time dictated by the
/// <param name="cronExpression" /> resolved with respect to the specified
/// <param name="timeZone" /> occurring from the <see cref="startTimeUtc" /> until
/// the given <paran name="endTimeUtc" />.
/// </summary>
/// <param name="name">The name of the <see cref="ITrigger" /></param>
/// <param name="group">The group of the <see cref="ITrigger" /></param>
/// <param name="jobName">name of the <see cref="IJobDetail" /> executed on firetime</param>
/// <param name="jobGroup">Group of the <see cref="IJobDetail" /> executed on firetime</param>
/// <param name="startTimeUtc">A <see cref="DateTimeOffset" /> set to the earliest time for the <see cref="ITrigger" /> to start firing.</param>
/// <param name="endTime">A <see cref="DateTimeOffset" /> set to the time for the <see cref="ITrigger" /> to quit repeat firing.</param>
public CronTriggerImpl(string name, string group, string jobName,
string jobGroup, DateTimeOffset startTimeUtc,
DateTimeOffset? endTime,
string cronExpression,
TimeZoneInfo timeZone) : base(name, group, jobName, jobGroup)
{
CronExpressionString = cronExpression;
if (startTimeUtc == DateTimeOffset.MinValue)
{
startTimeUtc = SystemTime.UtcNow();
}
StartTimeUtc = startTimeUtc;
if (endTime.HasValue)
{
EndTimeUtc = endTime;
}
if (timeZone == null)
{
timeZone = TimeZoneInfo.Local;
}
else
{
TimeZone = timeZone;
}
}