Use the date command to display the current date and time or set the system date / time over ssh session. You can also run the date command from X terminal as root user.

This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from the shell prompt.

You must login as root user to use date command.


Linux Display Current Date and Time

Just type the date command:

Sample outputs:


Linux Display The Hardware Clock (RTC)

Type the following hwclock command to read the Hardware Clock and display the time on screen:


OR show it in Coordinated Universal time (UTC):

Sample outputs:


Linux Set Date Command Example

Use the following syntax to set new data and time:

For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:


You can also simplify format using following syntax:


Linux Set Time Examples

To set time use the following syntax:


  • 10: Hour (hh)
  • 13: Minute (mm)
  • 13: Second (ss)

Use %p locale’s equivalent of either AM or PM, enter:


How do I set the Hardware Clock to the current System Time?

Use the following syntax:




A note about systemd based Linux system

With systemd based system you need to use the timedatectl command to set or view the current date and time. Most modern distro such as RHEL/CentOS v.7.x+, Fedora Linux, Debian, Ubuntu, Arch Linux and other systemd based system need to the timedatectl utility.

Please note that the above command should work on modern system too.


timedatectl: Display the current date and time

Type the following command:


Sample outputs:

Systemd Linux timedatecetl command to display the current date and time


How do I change the current date using the timedatectl command?

To change the current date, type the following command as root user:


For example set the current date to 2015-12-01 (1st, Dec, 2015):


Sample outputs:


To change both the date and time, use the following syntax:



  1. HH : An hour.
  2. MM : A minute.
  3. SS : A second, all typed in two-digit form.
  4. YYYY: A four-digit year.
  5. MM : A two-digit month.
  6. DD: A two-digit day of the month.

For example, set the date ’23rd Nov 2015′ and time to ‘8:10:40 am’, enter:


How do I set the current time only?

The syntax is:


Sample outputs:


How do I set the time zone using timedatectl command?

To see list all available time zones, enter:

To set the time zone to ‘Asia/Kolkata’, enter:

Verify it:


How do I synchronizing the system clock with a remote server using NTP?

Simply type the following command:

Verify it:

Sample outputs: