Reputation: 302
I´m trying to get the month with 05 format.
I´m executing:
PS C:\Users\olopez> (Get-date).adddays(-1).month
5
PS C:\Users\olopez>
How can I change the 5 format to 05?
I have tried with something like this:
PS C:\Users\olopez> $a= get-date -format d ((get-date).adddays(-1))
PS C:\Users\olopez> $a=Get-date -format dd-MM-yyyy
PS C:\Users\olopez> [datetime]::parseexact($a,"dd-MM-yyyy",$null)
Thursday, May 22, 2014 12:00:00 AM
PS C:\Users\olopez> [datetime]::parseexact($a,"dd-MM-yyyy",$null).month
5
PS C:\Users\olopez>
Obiously it returns 5 again :).
Thanks in advance
Upvotes: 0
Views: 32