[-Pattern] <string> ("* * * * *")
  [-Dt] <datetime> (System.DateTime.UtcNow)


>= kenaflow 3.0.13


Object of type kenaflow.CronDateTime.


"Cron" is a job scheduling pattern known from Un*x and Linux.

With this command you can calculate the next valid date and time for a given start date (UTC) and a a CRON pattern.

The CRON syntax can be found here:

We will not describe the syntax here.

kenaflow supports:

  • all match * ("all")
  • single numbers
  • lists, like 1,3,5,20,25,45
  • ranges, like 1-30
  • frequency, like 5/10

The return object of type kenaflow.CronDateTime looks like this:

    public class CronDateTime

        public DateTime Next();

        public void Reset();

        public DateTime Base {get;}

        public DateTime Current {get;}

You can get such an object with Get-KFCronUtc. Its based on a given System.DateTime and offers method Next() to get the next valid DateTime matching the pattern.

When calling Next() the new value is the basis for the next call to Next().

With Reset() you can reset the sequence.

With Base you get the initial DateTime value.

With Current you get the current DateTime value from the initialization or the last call of Next().


[-Pattern] <string> ("* * * * *")

The CRON pattern.

[-Dt] <datetime> (System.DateTime.NowUtc)

The DateTime as start reference.


This is a default parameter for all kenaflow cmdlets. If set to $true (default!) the engine will pass exception within the cmdlet to the script for further handling.


Import-Module "C:\Program Files\kenaflow\kenaflow.runtime.dll"
$dt = [DateTime]::UtcNow.AddDays(10)
$cronDt = Get-KFCronUtc -Dt $dt -Pattern "5 6 * * *"