Share via


Wrong value returned for get-date

Question

Saturday, April 21, 2012 1:03 PM

I am getting wrong data for get-date -format ddmmyyyy. Below are the values returned (Please note today's date is 21 April 2012)

PS C:\ get-date -format ddmm
2118
PS C:\ get-date -format mmddyyyy
18212012
PS C:\ get-date -format ddmmyyyy
21202012
PS C:\ get-date -format dd.mm.yyyy
21.23.2012

Why am I getting wrong value? Please help

All replies (5)

Saturday, April 21, 2012 1:10 PM ✅Answered | 1 vote

mm - minutes

MM - month

get-date -format ddMM


Saturday, April 21, 2012 1:28 PM ✅Answered

Try

 

get-date -format ddMMyy

Thanks
Manish

Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.


Saturday, April 21, 2012 2:51 PM ✅Answered

Interesting that

 

get-help get-date -full

 

does not mention MM

It incorrectly lists m as the two-digit month format selection.

 

Try

get-help -full get-date|out-string -stream|select-string ' m ' -casesensitive

  - Larry

 

On 4/21/2012 8:10 AM, Kazun [MVP] wrote:

> mm - minutes

>

> MM - month

>

> get-date -format ddMM

>

 

 


Saturday, April 21, 2012 1:29 PM

Thanks, I was using mm intead of MM.


Sunday, April 22, 2012 3:39 PM

I see now that the help formats are only for the -Uformat (UNIX format) variations.

 

For the .NET versions the values are not in the help text itself,

 but you are expected to look at

 

http://go.microsoft.com/fwlink/?LinkId=143638

  - Larry