Bootstrap FreeKB - PowerShell - Date and Time using Get-Date
PowerShell - Date and Time using Get-Date

Updated:   |  PowerShell articles

Get-Date without any options will return the current date and time.

> Get-Date
Monday, August 1, 2022 11:50:55 PM

 

The -format option can be used to format the output.

> Get-Date -format 'MM/dd/yyyy HH:MM:ss'
08/01/2022 23:08:35

 

Or, ToString can be used to format the output.

> (Get-Date).ToString('MM/dd/yyyy HH:MM:ss')
08/01/2022 23:08:35

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 4cf73a in the box below so that we can be sure you are a human.