Set-KFDateTime
Syntax
Set-KFDateTime
[-ReferenceDateTime] <datetime>
[-UTC[:$false]]
Set-KFDateTime
[-AddSeconds] <int>
[-ThrowErrors[:$true]]
Support
>= kenaflow 2.0.0
Return
Nothing.
Description
This is a tool cmdlet for debugging.
Together with Get-KFDateTime
and Set-KFDateTime
this cmdlet can be used to simulate time differences in a debugging context. First you set a time difference with Set-KFDateTime
that is relative to the current time. When you get the time using Get-KFDateTime
the difference is added or substracted from the current time. In combination with Get-KFInDebug
you can simulate a workflow run "later" or "earlier", e.g. if you check time stamps against the current time.
With Set-KFDataTime
you set the time difference.
The first option is to set a difference based on a DateTime specified with -ReferenceDateTime <datetime>
. During execution the difference between this DateTime and DateTime.Now
is calculated. When you later get the DateTime with Get-KFDateTime
this calculated difference is used to manipulate the current datetime. - When using -ReferenceDateTime
together with -UTC
the given DateTime is handled as UTC and the difference is calculated agains DateTime.UtcNow
.
The second option is to set a difference based on an amount of seconds specified with -AddSeconds <int>
. This can also be a negative value. When you later get the DateTime with Get-KFDateTime
this amount of seconds is added to manipulate the current datetime.
Parameters
[-ThrowErrors[:$true]]
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.
Example
Clear-KFDataTime