Use Culture-Specific Dates!

PowerShell always uses a culture-neutral approach when you implicitly convert a date. So this does not necessarily work with your own culture.

[DateTime]'24.1.2010'

Instead, a culture-aware way is to use the -as operator:

'24.1.2010' -as [DateTime]

This time, you can see that the string information is interpreted according to your current culture.


Posted Mar 16 2010, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.