Learn about Windows PowerShell
Summary: Use Windows PowerShell to easily change the way the date displays on your computer.
How can I use Windows PowerShell to display the date on my computer as a two-digit month, two-digit day, and two-digit year?
Use the ToString() method from the Get-Date cmdlet. Here are two examples:
PS C:\> (get-date).tostring("MM/dd/yy")
PS C:\> (get-date).tostring("MMddyy")
Why would you do this instead of calling 'Get-Date -Format MM/dd/yy' - wouldn't this return as a string as well?
Good tip. How about (get-date).toshortdatetime()
Sorry I mean (Get-Date).ToShortDateString()
Simple, but very useful !
Thanks for sharing
I have used the ToString() method several times. Comes in very handy, thanks for sharing!