Table of Contents
This tip is about the how to Adjust the Date and Time in Linux. So read this free guide, How to Adjust the Date and Time in Linux. If you have query related to same article you may contact us.
How to Adjust the Date and Time in Linux – Guide
The “time” command in Linux is an operation timer and does not show the system time. Although unreasonable, the Linux “date” command displays the time, as well as the date, on a Linux box. You can set the date and time on the Linux system clock with the help of the “set” key in addition to the “date” command. Remember that simply changing the system clock does not reset the hardware clock. Synchronize the system clock with the hardware clock after adjusting the date and time to preserve your settings when you exit and restart your computer.
How to change DATE and TIME on Linux
TIMEDATECTL Command
show date and time
To see the current date and time from the system clock, run
Change time
To change the system clock time, run
$timedatectl set-time HH:MM:SS
Where HH stands for hour, MM stands for minutes and SS stands for seconds.
Change of date
To change the system clock date, run
$ timedatectl set-time ‘YYYY-MM-DD HH:MM:SS’
Where YYYY is the year, MM is the month and DD is the day of the month. We also need to specify the time, otherwise it will be set to 00:00:00.
time zone change
First, to change the time zone of a system clock, we need to find the time zone we need to set. To find the time zone, run
$timedatectl timezone list
It will display the list of available time zones. Select the zone and run the following command to define it,
$timedatectl set-timezonetime_zone (Asia/dhaka).
DATE command
show date and time
To see the current date and time from the system clock, run
We can also customize the display date format using,
Change time
To change the system clock time, run
$ date +% T -s “HH: MM: SS”
It will set the time in 24-hour format. To use time in AM / PM format, use
$ date +% T% P -s “HH: MM: SSAM”
Change of date
To change the system clock date, run
$ date –s ‘DD MM YYYY HH: MM: SS’
To set the date in a custom format, use
$ date% y% m% d –s “YYYYMMDD”
HWCLOCK command
show date and time
To see the current date and time of your Hardware clock, run
date and time change
To change the Hardware clock time, run
$ hwclock –set –date “DD MM YYYY HH: MM”
Synchronizing Date and Time
To synchronize the hardware clock with the system clock, run
Or to synchronize the system clock with the hardware clock,
Final note
I hope you like the guide How to Adjust the Date and Time in Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.