For years, I’ve been using the following PowerShell code in my profile file to make sure I’m using ISO 8601 format for date.
$culture = Get-Culture $culture.DateTimeFormat.ShortDatePattern = 'yyyy-MM-dd' Set-Culture $culture
I’ve just installed PowerShell 7 and suddenly this code does not work anymore. I got this error message:
2 | $culture.DateTimeFormat.ShortDatePattern = ‘yyyy-MM-dd’
| Exception setting “ShortDatePattern”: “Instance is read-only.”
So, what is the new and correct way of doing this in PowerShell 7? Please.