6 lines
296 B
PowerShell
6 lines
296 B
PowerShell
$date = Read-Host "Enter the date (yyyy-mm-dd):" -Prompt "Invalid date format. Please try again (yyyy-mm-dd):" -ValidateScript {
|
|
# Parse the date input and return $true if it is in the correct format,
|
|
# or $false if it is not
|
|
$date = [DateTime]::Parse($_)
|
|
return $date -ne $null
|
|
} |