How To Set Date In Ubuntu
Introduction
Mod operating systems detect and synchronize time using NIST (National Establish of Standards and Applied science) fourth dimension servers. NIST operates an atomic clock that neither gains nor loses a second in 300 meg years.
Still, you may find that your organization is not synchronizing with NIST fourth dimension servers properly.
This guide shows yous how to check, alter the fourth dimension, date, and timezone in Ubuntu.
Prerequisites
- Some operations may require sudo or root privileges
- The command line/terminal window (Ctrl-Alt-T)
Virtually modern distributions such equally Fedora, Debian, Ubuntu, Curvation, CentOS v.7.10+, and other Unix-based systems use the timedatectl
utility. This command allows you to control and edit time and engagement settings using the command line.
Using timedatectl to Command the Organisation Time and Engagement
Display Current Engagement and Time with timedatectl
To brandish the current fourth dimension and engagement information use the command:
timedatectl
The output provides local and universal time, timezone, and informs you if the synchronization process is enabled.
Sync Time to NIST Atomic Clock
Yous can set your Ubuntu organization to synchronize to the NIST diminutive clock:
timedatectl set-ntp yes
If you need to plough off NTP synchronizing to be able to conform the time and appointment manually, use:
timedatectl prepare-ntp no
Notation: NTP stands for Network Time Protocol.
How to Change the Fourth dimension
This simple command sets the time to your specifications. For it to work, the automatic time synchronization needs to exist disabled every bit discussed previously.
timedatectl set-fourth dimension 21:45:53
The time format should exist in HH:MM:SS (Hours, Minutes, Seconds).
How to Change the Date
The same command is used to define the date besides:
timedatectl gear up-time 2022-04-10
The date should be formatted as YYYY-MM-DD (Year, Month, and Day).
How to Set a Timezone in Ubuntu
The timedatectl
command additionally allows yous to synchronize your systems with a timezone of your choosing. These are the steps:
1. To list out the names of the timezones:
timedatectl list-timezones
2. Observe the location closest to y'all, and so enter the post-obit:
timedatectl set-timezone Region/Location
three. Supersede Region/Location with a name from the timezone list.
The timezone list is extensive. Yous may desire to filter the list past keyword, using grep
:
timedatectl list-timezones | grep keyword
The | is a piping symbol, usually next to the Enter key. You can substitute keyword for any keyword y'all wish, such as America, Asia, or New_York. If you get an error, double-check your spelling and make sure that y'all are using uppercase messages correctly.
How to Set Universal Fourth dimension (UTC) in Ubuntu
UTC stands for Coordinated Universal Time and is used for scientific calculations and synchronizing betwixt timezones beyond the earth. Y'all tin synchronize your organisation by entering the following command:
timedatectl fix-timezone UTC
There is no immediate output; however, you lot can cheque if the settings applied by using timedatectl
.
Note: GMT and Zulu Time are often used to refer to UTC. They are equivalent terms when fractions of a second are non relevant.
How to Sync Hardware Clock
RTC stands for Real-Fourth dimension Clock, some other name for the hardware clock in your computer. Your system has a tiny quartz crystal and a bombardment that keeps time at times when the organization disconnects from a network.
Set Hardware Clock to Sync to Local Timezone
To accept your Real-Fourth dimension Clock synchronize to your local timezone enter:
timedatectl set-local-rtc i
You lot may get an error in this mode, since updating the hardware clock to the local timezone is unsupported.
Set the Hardware Clock to Sync with UTC
If necessary, you can set your hardware clock to synchronize with UTC by inbound the following command:
timedatectl set-local-rtc 0
Every bit with the previous control, there is no confirmation that the change has applied. You demand to verify the change manually past using the timedatectl
command.
Set Fourth dimension, Date Timezone in Ubuntu Older Versions From Command Line
Older Ubuntu versions may not support the timedatectl
command. Find out how to go the Ubuntu version.
Yous can still display and accommodate system time setting from a command line by using the commands listed below:
- To display the date and time of the operating organisation use:
engagement
- Change the date of the operating system by typing:
sudo appointment -s YY-MM-DD HH:MM:SS
Replace YY-MM-DD with Year-Month-Mean solar day, and HH:MM:SS with Hour:Minute:Second. You tin gear up just the date or merely the time, depending on your needs.
- Display the time kept past the hardware clock (RTC) by using whatever of the following commands:
sudo hwclock -r
or
sudo hwclock --show
or
sudo hwclock --show --verbose
Notation: Some versions may not support the –-verbose option, and it may not work on a virtual machine. The hardware clock may not agree the same time equally the operating system.
- Display the RTC time in UTC format:
sudo hwclock --show --utc
- Change the fourth dimension kept past the RTC:
sudo hwclock --prepare --appointment MM/DD/YY HH:MM:SS
- Set Os fourth dimension based on the hardware clock (RTC):
sudo hwclock --hctosys
This command tells the organization to set up the HC (hardware clock) to SYS (system):
- Ready the RTC based on the operating organisation time:
sudo hwclock --systohc
Use this command to reverse the previous process.
Conclusion
This guide showed you how to set the time, appointment, and timezone on your Ubuntu system. As we learned, setting your system to synchronize with NTP is typically the best course of action.
Was this article helpful?
Aye No
Source: https://phoenixnap.com/kb/how-to-set-or-change-timezone-date-time-ubuntu
0 Response to "How To Set Date In Ubuntu"
Post a Comment