date command
**
Get system time
**: date
Syntax 1: date, output:
Syntax 2: date "+% F" (equivalent to date "+% Y-% m-% d")
Syntax 3: date "+% F% T" (etc. Price on date + "+% Y-% m-% d% H:% M:% S")
Syntax 4: Get a time before or after (backup)
date -d "-1 day" "+% Y -% m-% d% H:% M:% S "
optional values: + (after),-(before)
optional values of units: day (day), month (month), year (year)
hwclock command (server hardware time)
Function: Obtain computer hardware RTC time
Set system time
date -s "2012-12-12 10:10:10", -s means to set the system time (set)
Option 1: hwclock -w, save the Linux system time to the hardware RTC (applicable to hardware time error, set After the system time, synchronize the system time to the hardware time)
Option two: hwclock -s, save the time in RTC to the Linux system time (applicable to system time error, directly recover from the hardware time)