What is the command to update time and date from Internet? Is there any application that allows me to do so from its user interface rather than from the shell?
What is the command to update time and date from Internet? Is there any application that allows me to do so from its user interface rather than from the shell?
This is a nice little code I found to update your time in case you have issues with
ntp
:You can do so with e.g.
sudo ntpdate time.nist.gov
. Other servers includetime.windows.com
, etc.http://www.pool.ntp.org/ lists time servers around the world.
As of 2018 with a fresh installed Ubuntu 16.04 LTS, running
sudo ntpdate time.nist.gov
gives:This is because (official source):
Instead do this to force the sync to happen now:
In my case I was running a Ubuntu on a virtualbox and had saved the machine state so when I started the instance back up again it did not automatically sync the clock since there was no boot event to trigger the sync. So the time was still showing what it was the last time I was running the virtual box.
Running this command in a terminal should do the trick
You can add extra time zones graphically, I think, by clicking on the clock and going through its options.
It's very easy to set up from command line: https://help.ubuntu.com/lts/serverguide/NTP.html From that link:
Here's GUI example https://help.ubuntu.com/community/UbuntuTime#Time_Synchronization_using_NTP
Most here won't work, since ntp will override your settings within seconds.
You need to disable NTP first. On ubuntu it is done as:
Then you can do:
or
I had this issue because I would pause a VM for a while and when I resume, Ubuntu 20.04 would refuse to update any packages until the time was corrected. (i.e. packages were not from the 'future').
The easiest way (by terminal) was to run this command:
Tested on Ubuntu's main GNOME edition 20.04.
No need for a separate command to restart NTP. Updates the reported time in GNOME as well.
You can add this to your bash files:
and run the command after reloading your bash files (or opening a new terminal).
I'm using 17.10 and can go to Settings (from the upper-right menu in the UI) > Details > Date & Time. In my case, my system wasn't updating from the Internet even though "Automatic Date & Time" was set to "ON". I simply changed it to "OFF", waited a second, then changed it back to "ON". It picked up the current date and time and I was good to go.
You need to install the
ntp
package. Date/Time settings are availble under system settings. Here's some more information.