The date command in Linux is capable of converting the date and time from UTC to the local time of your system.
It’s also possible to do the reverse, and convert your local time to UTC with
date. In this tutorial, we’ll show how to convert UTC date and time to local time on the Linux command line. You’ll also see how to convert to other various time zones.
In this tutorial you will learn:
- How to convert UTC date and time to local time
- How to convert other time zones to local time
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
|Conventions||# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Convert UTC to local time
See the examples below to learn how to use the
datecommand to convert between UTC and other time zones.
- Keep in mind that your local time zone can always be ascertained with the following command.
$ ls -l /etc/localtime lrwxrwxrwx 1 root root 36 Mar 9 2021 /etc/localtime -> /usr/share/zoneinfo/America/New_York
- In the below example, we will convert UTC time to local time (EDT, in this case).
$ date -d '2014-06-26 23:00 UTC' Thu 26 Jun 2014 07:00:00 PM EDT
- You can also specify a time by itself, without the date.
$ date -d '23:00 UTC' Sun 10 Oct 2021 07:00:00 PM EDT
- You can also convert from other time zones. For example, this command converts from CEST (Central European Summer Time) to local time.
$ date -d '2021-06-26 23:00 CEST' Sat 26 Jun 2021 05:00:00 PM EDT
That’s all there is to it. Converting between UTC or some other time zone to your local time zone is very easily done with the
date command. To see what else you can do with the command, check out our full tutorial on the date command.