In this module, we will see how to set date and time in Kali Linux. Time and date are set during installation of the operating system on hardware. If we skip the setting of time and date, during the installation of Kali Linux, then it may show different time and date.
Kali Linux is a Debian based Linux distribution geared for vulnerability and penetration testing. It is full of different types of pen-testing applications. Kali Linux is primarily used ethical hackers.
We can set any date and time or both using below methods:
- Graphical User Interface (GUI) of Kali Linux
- Command Line Interface (CLI), using some handy commands
Let’s go for each method one by one…
Using GUI method
On our Kali Linux, right click on time showing in corner of window with group of some other indicators (Connection, Speaker, Notifications, Power, Time etc…).
Click on Properties option from drop-down menu.
Now, in the opened window, start typing your timezone in Timezone textbox. And matching timezone options will start appearing below. And select your timezone.
After selecting our timezone. Current date and time got corrected on our Linux PC. After that, we can close this window.
After confirm the updated date and time.
We can also select a custom Date and Time, let’s see how?
Setting custom Date and Time
To choose a custom date and time. Click on Date and Time Settings button in Clock window.
In the newly opened window, click on Unlock button before changing date or time. Otherwise, we will not able to change date or time.
After that, it will ask for our password to authenticate. Authenticate with your password.
After authentication, manual change date and time. After that, click on Lock button.
Now, we have successfully updated to our desired date and time in Kali Linux using GUI (Graphical User Interface).
Let’s see how to change date and time using CLI (Command Line Interface).
Using CLI method
Using Command Line, we change date and time by two commands.
timedatectl
commanddate
command
Lets each command one by one.
timedatectl command
For synchronization date and time to our timezone using timedatectl command, use the following command.
sudo timedatectl set-timezone <our timezone>
We can also see list of timezones and choose accordingly list using below command.
timedatectl list-timezones
For setting custom date and time using timedatectl
the command, follow the following syntax. And pass date, time or both in the format “YYYY-MM-DD HH:MM:SS”.
timedatectl set-time "YYYY-MM-DD HH:MM:SS"
To set only time, follow the command as below.
sudo timedatectl set-time HH:MM:SS
To set only date, follow the command as below.
sudo timedatectl set-time YYYY-MM-DD
However, this can create problems as it may not synchronize with RTC (Real Time Clock), which is a hardware clock in our PC run by small battery and runs even PC is powered off to PC to synchronize with time.
date command
To set time, you can use the “-s” option with the date
command in format “DD MM YYYY HH:MM:SS”. For example, to set date and time to March 15th 2021 15:25:47, we will use the following command.
sudo date -s "15 Mar 2021 15:25:47"
Another example, to set date and time to Dec 17th 2025 11:57:12 with other format “MM DD HH:MM:SS YYYY”
sudo date -s "Dec 17 11:57:12 2025"
We have seen to change date or time or both using both timedatectl
and date
command. Now, you can change this on your PC without any hassle.
Conclusion
In this module, we discussed how to change date or time or both on Kali Linux. We used a Graphical User Interface to apply changes. We also saw Command Line to change these using timedatectl
and date
commands. Also, though, we used Kali Linux, but the same applies to other distributions.
Also Read
- Manual web page for
timedatectl
command - Linux date Command
- How to change or set the time zone in Ubuntu 20.04?