How to get the current date in a short date format in PowerShell?
To get the current date in a short date format in PowerShell, you should use ToString() function as the following:
$(Get-Date).ToString('yyyy-MM-dd')
Output
How to get the current Time in PowerShell?
To get the current Time in Hour:Minutes:Seconds
format in PowerShell, you should use the below cmdlet:
$(Get-Date).ToString('hh:mm:ss')
Output
How to get the AM/PM Time in PowerShell?
To get the current Time in AM/PM format in PowerShell, you should use "tt" as below:
$(Get-Date).ToString('hh:mm:ss tt')
Output