I'm trying to write a function in Powershell where I calculate the age of the user based on the birthdate. So it should probably be currentdate - birthdate and put the difference in years. I'm getting stuck however, on the formating of these dates because the user has to input their birthdate.
Function getAge ($birthDate)
{
$currentDate = Get-Date
$age = $currentDate - $birtDate
Write-Host "Your age is $age"
}
getAge 24-01-1991