I want to parse this String I get from OpenSSL to DateTime:
Dec 23 03:54:47 2021
I tried the following things without success:
([datetime]::ParseExact($datestring, "%b %H:%M:%S %Y", $null))
([datetime]::ParseExact($datestring, "bbb HH:MM:SS YYYY", $null))
CodePudding user response:
The format string you want is MMM dd HH:mm:ss yyyy
:
PS ~> [datetime]::ParseExact('Dec 23 03:54:47 2021', 'MMM dd HH:mm:ss yyyy', $null)
Thursday, December 23, 2021 3:54:47 AM