I'm in need to temporarily change the date to debug one script and I run inti unexpected problem:
root@xxx:/# LC_ALL=C date
Wed Jan 31 17:09:02 EET 2018
root@xxx:/# LC_ALL=C date -s "2018-01-10 17:09:30"
Wed Jan 10 17:09:30 EET 2018
root@xxx:/# LC_ALL=C date
Wed Jan 31 17:09:28 EET 2018
note: I have a ru_RU
locale, so I use LC_ALL=C
for your convenience. Using the commands without LC_ALL
change nothing.
I guessed that I do something wrong with syntax or reading man
incorrectly, so I used instructions from this thread and it solved nothing. attempts to set hwclock to match date resulted in nothing:
root@xxx:/# LC_ALL=C hwclock --systohc
root@xxx:/# LC_ALL=C hwclock --show
Wed Jan 31 17:18:17 2018 .451473 seconds
root@xxx:/# man hwclock
root@xxx:/# hwclock --set --date='2011-08-14 16:45:05'
root@xxx:/# LC_ALL=C hwclock --show
Sun Aug 14 16:45:09 2011 .389008 seconds
root@xxx:/# LC_ALL=C date
Wed Jan 31 17:21:07 EET 2018
How can I change date?
System:
root@xxx:/# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
UPDATE for @Yaron
kovjr@xxx:~$ LC_ALL=C sudo date 120622432007.55
[sudo] password for kovjr:
Thu Dec 6 22:43:55 EET 2007
kovjr@xxx:~$ LC_ALL=C date
Wed Jan 31 18:19:23 EET 2018