Test-IsDate is a simple function which tests a string to determine whether it is a date.
function Test-IsDate([string]$sDate) { [boolean]($sDate -as [DateTime]) }
Test-IsDate ‘Monday, August 13, 2018 1:28:48 PM’ returns True.
"Yeah. I wrote a script that will do that."
Test-IsDate is a simple function which tests a string to determine whether it is a date.
function Test-IsDate([string]$sDate) { [boolean]($sDate -as [DateTime]) }
Test-IsDate ‘Monday, August 13, 2018 1:28:48 PM’ returns True.