Hi,
may be I am wrong somewhere
but with the following cron, 0 18 16 ? * SUN,MON,TUE,WED,THU,FRI,SAT
// I call it at <00:16:16 22/04/2025>
while (!cancellationToken.IsCancellationRequested)
{
DateTime now = DateTime.UtcNow;
DateTime? nextExecTime;
CronExpression nextExecCron = CronExpression.Parse(treatment.Cron, CronFormat.IncludeSeconds);
nextExecTime = nextExecCron.GetNextOccurrence(now.**AddMinutes**(1));
// I got <00:18:16 22/04/2025>
int delay = (int)(nextExecTime.Value - DateTime.Now).TotalMilliseconds;
//wait for delay
} //while
I call it at <00:16:18 TUE> + ONE MINUTE
I got <00:18:16 22/04/2025> ==> SO BACK IN TIME ??
should have <00:18:16 23/04/2025>
if i debug and wait for several minutes, i got the same result...
thanks for your help
Hi,
may be I am wrong somewhere
but with the following cron,
0 18 16 ? * SUN,MON,TUE,WED,THU,FRI,SATI call it at <00:16:18 TUE> + ONE MINUTE
I got <00:18:16 22/04/2025> ==> SO BACK IN TIME ??
should have <00:18:16 23/04/2025>
if i debug and wait for several minutes, i got the same result...
thanks for your help