Display Date And Time In Linux

See all GNU/Linux related FAQ
How do I display date and time in Linux using the command line and GUI options?

To display current date and time under Linux operating system using command prompt use the date command or timedatectl command. These commands 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 terminal
Category Commands
Prerequisites date command
OS compatibility AlmaLinux Alpine Arch CentOS Debian Fedora Mint openSUSE Pop!_OS RHEL Rocky Stream SUSE Ubuntu WSL
Est. reading time 3 minutes


Open a terminal application and type the following command:
$ date

Sat Nov  7 22:44:59 IST 2009

You can format the date as follows in dd-mm-yy format:
$ date +"%d-%m-%y"
Here is what I see:


Simply display the current time on Linux:
date "+%T"
Sample outputs:


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 command

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 ##
$ time-admin
##On the latest version of GNOME 3.xx/4.xx ##
$ gnome-control-center datetime

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 or help command. For instance:
$ man date
$ man bash
$ man ksh
$ man timedatectl
$ date --help
$ timedatectl --help

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

12 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.

  • Piper Aug 25, 2022 @ 3:26

    I want Linux to find system time. So I use the timedatectl command. Open ssh:

    ssh ec2-user@aws-ip-address

    Then type “timedatectl” at the command prompt. This will display the current system time and date settings on Linux:

  • Firas Oct 5, 2022 @ 18:30

    Simply display the current time on Linux:
    date “+%T”

    Sample outputs:


    there’s a mistake here where date “+%T” should be date +”%T”

    • 🛡️ Vivek Gite (Author and Admin) Vivek Gite Oct 5, 2022 @ 21:00

      Both syntax should work. For example, all of the following are valid:
      date "+%T"
      date +%T
      date +'%T'
      date +"%T"

      Are you getting any error? If so let me know your Linux distro version.

      • Anonymous Nov 3, 2022 @ 7:57

        Thank you for all tutorials

  • Matthew Dec 7, 2022 @ 12:31

    It may not be intuitive but the “days ago” form will accept negative numbers so the day after tomorrow could be found with
    $ date --date='-2 days ago'
    Wed 7 Dec 10:28:22 GMT 2022

    It will also take other keywords from seconds to years
    $ date --date='2 hours ago'
    Wed 7 Dec 10:28:22 GMT 2022

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.