====== Useful 'date' Commands ====== **Step the system time** by a specific amount (run as **''root''**): date -s "+1 second" # adjust the system time by +1 second date -s "-0.01 second" # adjust the system time by -10 milliseconds \\ Display the **current** UTC date as **seconds since epoch**: date -u +%s 1594828693 # = 0x0x5F0F2795 \\ Display a **specific** UTC date or time as **seconds since epoch**: date -u -d "2020-07-15" +%s 1594771200 # = 0x5F0E4700 date -u -d "17:30:00" +%s 1594834200 # = 0x0x5F0F3D18 \\ Display the **human readable date and time** for specific seconds since epoch: date -u -d @1483228800 Sun Jan 1 00:00:00 UTC 2017 \\ Display the **human readable date and time** for the last second before the signed 32 bit Unix time_t rolls over, and for the next second thereafter. Use the ''printf'' command to determine the associated decimal number of seconds to be passed to the ''date'' command. # last second before rollover (same on 32 and 64 bit system) date -u -d @`printf "%i" 0x7FFFFFFF` +'%F %T' 2038-01-19 03:14:07 # first second after the rollover (on 64 bit system) date -u -d @`printf "%i" 0x80000000` +'%F %T' 2038-01-19 03:14:08 # first second after the rollover (on 32 bit system) date -u -d @`printf "%i" 0x80000000` +'%F %T' date: ~~codedoc: invalid date `@2147483648'~~ ---- --- //Martin Burnicki [[martin.burnicki@burnicki.net]] last updated 2020-07-15//