gAMBOOKa Asked: 2010-07-15 02:24:26 +0800 CST2010-07-15 02:24:26 +0800 CST 2010-07-15 02:24:26 +0800 CST Changing linux date with current time 772 I am running sudo date +%m/%d/%Y -s 7/14/2010 command to change date. It changes fine except I want it to pick up the current time as well, and not start the time from 00:00:00 on 7/14/2010. linux time date 3 Answers Voted Best Answer Karol J. Piczak 2010-07-15T02:35:52+08:002010-07-15T02:35:52+08:00 Just extend the call to include hour information too: sudo date +"%m/%d/%Y %H:%M:%S" -s "7/14/2010 10:00:00" vitalie 2010-07-15T04:09:50+08:002010-07-15T04:09:50+08:00 If you need accurate time, use ntpdate or better run ntpd daemon: Example: /usr/sbin/ntpdate clock.redhat.com Warner 2010-07-15T05:22:35+08:002010-07-15T05:22:35+08:00 It is often a good idea to sync the BIOS clock if there is that much of an offset after changing. This can be done via: hwclock --systohc Typically distributions write to BIOS on a shutdown.
Just extend the call to include hour information too:
If you need accurate time, use ntpdate or better run ntpd daemon:
Example:
It is often a good idea to sync the BIOS clock if there is that much of an offset after changing. This can be done via:
hwclock --systohc
Typically distributions write to BIOS on a shutdown.