ConvertTo Date - PPOSHGROUP/PPoShTools GitHub Wiki
PPoShTools -> ConvertTo-Date.ps1
Converts a string to a DateTime using specified DateFormat.
ConvertTo-Date [[-String] <String>] [[-DateFormat] <String[]>]
[-ThrowOnFailure] [<CommonParameters>]
See https://msdn.microsoft.com/en-us/library/az4se3k1%28v=vs.110%29.aspx for description of format strings.
String to be converted to date.
- PipelineInput: false
- Required: false
Date formats that will be used to parse the string. If not specified, system default will be used.
- PipelineInput: false
- Required: false
If true, exception will be thrown if failed to convert string to date. Otherwise, $null will be returned.
- DefaultValue: False
- PipelineInput: false
- Required: false
$date = ConvertTo-Date -String '2015-03-05' -DateFormat 'yyyy-MM-dd'