header image

More date oddities

Posted by: | February 19, 2011 | 2 Comments |

I’ve mentioned before that if I do this


I get

09 October 2011 00:00:00

which is not what I expect as I live in the UK


Just been experimenting and discovered that

Get-Date "10/09/2011"


works correctly (for me) and returns

10 September 2011 00:00:00


It seems Get-Date picks up the locale and culture correctly but casting to [datetime] doesn’t.

under: PowerShellV2


  1. By: Russ Pitcher on February 21, 2011 at 4:21 am      

    Lee Holmes covered this on his blog a little while ago. It seems that this was a design decision to avoid confusion (if you are from the US I guess)


  2. By: pan_2@LJ on February 23, 2011 at 6:45 am      

    Thats because PS internally runs all date-time functions on american standart, so it will be consistent anywhere, no matter of user locale.