Forrest logo
back to the timedatectl tool

timedatectl:tldr:8bc2e

timedatectl: Set the local time of the system clock directly.
$ timedatectl set-time "${yyyy-MM-dd hh:mm:ss}"
try on your machine

The command "timedatectl set-time" is used to set the system's date and time.

In this specific command, the date and time value are passed as a parameter within quotes: "${yyyy-MM-dd hh:mm:ss}".

The format used is "yyyy-MM-dd hh:mm:ss", where:

  • "yyyy" represents the four-digit year,
  • "MM" represents the two-digit month (01 for January, 02 for February, etc.),
  • "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, and
  • "ss" represents the two-digit second.

So, when you execute this command with a specific date and time value in the given format, the system's date and time will be set accordingly.

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 timedatectl tool