Display Date And Time In Linux

How do I display date and time in Linux using the command line and GUI options?

To display date and time under Linux operating system using command prompt use the date command. It can also display the current time / date in the given FORMAT. We can set the system date and time as root user too.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements Linux with the terminal application
Est. reading time 3 minutes


Open a terminal and type the following command:

Sat Nov  7 22:44:59 IST 2009

You can format the date as follows in dd-mm-yy format:
date +"%d-%m-%y"


Simply display the current time:
date "+%T"


To print the date of the day before yesterday, run:
date --date='2 days ago'
Want to see the day of year of Christmas in the current year? Try:
date --date='25 Dec' +%j
Display the current full month name and the day of the month:
date '+%B %d'

Display date and time in Linux using the timedatectl

Most modern Linux distro with systemd use the timedatectl command. It is used to query and change the system clock and its settings, and enable or disable time synchronization services. All you have to do is type the following command:
$ timedatectl
Linux Display Date And Time Using Command Line

TZ environment variable

The TZ environment tells Linux what time zone you are in. Many times when you want to change your time zone temporarily. For example, you might want to print the current date and time in “America/Los_Angeles” timezone even though you are in “Europe/London”. So we can set TZ, give a command like as follows when using TCSH/CSH:
setenv TZ timezone
For BASH/KSH/SH (see export command:
TZ=timezone; export TZ
Another option:
TZ="America/Los_Angeles" date
TZ="Asia/Tokyo" date

Use the following command to print a list of all timezones:
timedatectl list-timezones
timedatectl list-timezones | more
## filter out data using the grep command/egrep command ##
timedatectl list-timezones | grep -i Hong_kong
timedatectl list-timezones | grep -i paris
timedatectl list-timezones | grep -E -i 'paris|london|kolkata'

TZ and timedatectl timezones on Linux

The TZ Environment Variable on Linux

GUI Tool: Time Administration

The Time Administration Tool allows you to set the time, date and timezone of your system, as well as setting any time server to synchronize your local time server. Type the following command to start time admin tool:
sudo time-admin
## OR ##

Fig.01: Linux Date and Time  Administration Tool

Fig.01: Linux Date and Time Administration Tool

You may be prompted for the administrator password (root password), this is necessary because the changes done with this tool will affect the whole system.

How to change date and time settings with Gnome based Linux desktop

First, you need to Settings in Activities and then click Details in the sidebar. Make sure you click Date & Time in the sidebar to open the panel:
Gnome date and time settings


In this quick tutorial, you learned about the date command that you can use to see or change the date/time under Linux operating systems. We further explained how to use the GUI tools too. The date command has many more options. See man page by typing the following man command:
$ man date

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 7 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
7 comments… add one
  • ramkumar Apr 5, 2013 @ 8:53

    sir i want to set date format to dd/mm/yyyy but not able to do it
    that when i execute date command i get output in dd/mm/yyyy format if any help
    please reply

    ramkumar sharma

    • Sharil Ali PV Jul 1, 2013 @ 9:51

      Please try this

      date +%d/%m/%Y

  • janine May 9, 2014 @ 10:02

    hi sir i want to ask favor . can u answer this my project.
    converting php to mysql
    and inserting date and time in/out
    thank u sir..
    hope u get it

  • John Jun 28, 2014 @ 18:23

    Is there any way this can be done in the motd and show the current time of the login?

  • User888 Nov 27, 2016 @ 16:42

    How can someone from termial get current time from any zipcode around the world?

  • Rob dawney Sep 26, 2020 @ 15:12

    Damnn, thanks alot! I was looking for this but didnt find it any where till now. Great content Guys!

  • Svend Aleah Warren Mar 25, 2021 @ 12:28

    Checking time on Linux and I tried time. It did something else. Finally a page explained how to to get time using the date. The date "+%T" worked fine but I need HH:MM (AM/PM) in both 24 and 12 hour format:
    date +"%H:%M"
    12 hour format:
    date +"%I:%M %p"
    Without this page I would have never figure out a way to do it.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum