Product: PowerShell Universal
Version: 5.6.5
Hi
Since upgrading powershell I’ve had a strange issue with a script that I am running this takes a date time as a string and converts it to a DateTIme object. When running it on the server I am getting
Cannot bind parameter 'Date'. Cannot convert value "30/09/25 13:34:56" to type "System.DateTime". Error: "String '30/09/25 13:34:56' was not recognized as a valid DateTime."
(I should mention that I am in the UK). I’ve manually ran the Get-Date from the Powershell terminal and get the same message.
If I run the same on my local laptop it runs fine. If I log onto the server and run through the powershell instance on the machine it also runs fine.
Where is the locate set in powershell universal? I am aware that I could use ParseExact but I am a little wary that if the locale is wrong then I might end up with dates written as US dates elsewhere.
Thanks