Forrest logo
back to the Get-Date tool

get-date:tldr:921ac

get-date: Display the current date and time.
$ Get-Date
try on your machine

The command "Get-Date" is used in PowerShell to retrieve the current date and time. When run, it returns the current system date and time based on the computer's clock settings.

By default, when you execute the "Get-Date" command, it will display the current date and time in the format specified by the operating system's regional settings. However, you can also specify a specific format for the output by using additional parameters.

For example, you can use the "-Format" parameter to format the output using a custom format string. This allows you to display the date and time in a specific format of your choice, such as "dd-MM-yyyy" for day-month-year.

Here's an example of running the "Get-Date" command in PowerShell:

PS> Get-Date

Thursday, March 25, 2021 1:30:45 PM

This will display the current date and time in the default format.

Overall, "Get-Date" is a useful command in PowerShell for retrieving and working with dates and times. It can be used in scripts or interactively within the PowerShell environment to perform various tasks involving time-dependent operations.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the Get-Date tool