I used to do it the long way, gathering the minute, hour or the day, month, year. Then I learned about -format, and it changed everything and made the code much shorter.
Get-Date -Format "yyyyMMdd"
20150522
Get-Date -Format "MM-dd-yy"
05-22-15
See:
http://technet.microsoft.com/en-us/library/ee692801.aspx
No comments:
Post a Comment