Gets the value for the specified key converted to a
DateTime
. This method never throws an exception. It will return the specified
default value if the key is not found.
- Namespace
- Statiq
.Common - Containing Type
- I
Metadata Conversion Extensions
Syntax
public static DateTime GetDateTime(this IMetadata metadata, string key, in DateTime defaultValue = default(DateTime))
Parameters
Name | Type | Description |
---|---|---|
metadata | IMetadata | The metadata instance. |
key | string | The key of the value to get. |
defaultValue | DateTime | The default value to use if the key is not found or cannot be converted to a DateTime . |
Return Value
Type | Description |
---|---|
DateTime | The value for the specified key converted to a DateTime or the specified default value. |