Gets the current date/time using the
CurrentDateTime metadata setting if it's set,
otherwise using the value of ExecutionDateTime (which is
System.DateTime.Now at the time execution started).
- Namespace
- Statiq
.Common - Containing Type
- I
Execution State Extensions
Syntax
public static DateTime GetCurrentDateTime(this IExecutionState executionState)
Remarks
This method should always be used instead of
System.DateTime.Now or System.DateTime.Today
whenever possible, by both code and themes.
Parameters
| Name | Type | Description |
|---|---|---|
| executionState | IExecutionState |
Return Value
| Type | Description |
|---|---|
| DateTime |