8

I am trying to set the time, using e.g.

date -s "11/20/2003 12:00:00"

however, after a few moments, the system time resets to the current time. What am I doing wrong?

NTP should not get a different time, as this is a NTP server that has no connection to any other NTP server.

Phil
  • 133
  • 1
  • 2
  • 9

2 Answers2

7

if you have the npt > apt-get install ntp. You must stopping or uninstalling the service doesn't help.

timedatectl set-ntp 0 (off > sync disabled)
or     
timedatectl set-ntp 1 (on > sync enabled)

Disable with timedatectl set-ntp 0 then you can change date:

date --set 1998-11-02 
date --set 21:08:00

see Maintaining Time on Debian - Datetime and NTP client and server

Milor123
  • 145
  • 1
  • 9
1

Method 1:

# Find your timezone
$ timedatectl list-timezones
$ timedatectl set-timezone "YOUR-TIMEZONE"

Method 2:

$ timedatectl set-time "HH:MM:SS"

NOTE: 24 - Hours Time Format

TIP: Make sure to synchronize your system clock (RTC) with the hardware clock as well.

$ hwclock -w
R3DB4R0N
  • 11
  • 4