UK Date Format dd/mm/yy


if run following commands in powershell version 2 don't final date have expected

ps c:\> get-culture

lcid             name             displayname
----             ----             -----------
2057             en-gb            english (united kingdom)


ps c:\> [datetime]$d1=get-date
ps c:\> $d1

08 july 2010 17:42:39


ps c:\> $d1.toshortdatestring()
08/07/2010
ps c:\>
ps c:\> $d1="08/07/2010"
ps c:\> $d1

07 august 2010 00:00:00

ps c:\> $d1.toshortdatestring()
07/08/2010

in first instance $d1.toshortdatestring() outputs short date expect in form

dd/mm/yyyy

however when input shortform string, seems take in mm/dd/yyyy format.

could somone kindly point out i'm missing.

paul in uk


london uk

hi,

it seems design behavior. get-date using thread.currentthread.currentculture format date while .net datetime (the [datetime] type accelerator) not.

based on situation, please use get-date correct result.

thanks.


this posting provided "as is" no warranties, , confers no rights. please remember click "mark answer" on post helps you, , click "unmark answer" if marked post not answer question. can beneficial other community members reading thread.


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Edit Group Policy

Hyper-V VM not reaching OS 'Logon' screen

DNS question...