Forrest logo
back to the Get-Date tool

get-date:tldr:9d1c5

get-date: Display the current date and time with a .NET format specifier.
$ Get-Date -Format "${yyyy-MM-dd HH:mm:ss}"
try on your machine

The command "Get-Date" is a PowerShell cmdlet used to retrieve the current date and time on the system.

In this specific example, the command "Get-Date -Format" is used to format the output of the current date and time according to the provided format string.

The format string used is "${yyyy-MM-dd HH:mm:ss}". Here's what each part of the format string represents:

  • "yyyy": represents the four-digit year.
  • "MM": represents the two-digit month.
  • "dd": represents the two-digit day of the month.
  • "HH": represents the two-digit hour in 24-hour format.
  • "mm": represents the two-digit minute.
  • "ss": represents the two-digit second.

By using this format string, the command will output the current date and time in the following format: "YYYY-MM-DD HH:MM:SS", where each component represents the corresponding value.

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