总是忘记date的用法
# date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S" 2021-12-18 21:55:56 # cat /proc/uptime 2144676.83 2131002.93 # date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" Sat Dec 18 21:55:56 HKT 2021 # date -d "20211003 +90 day" Sat Jan 1 00:00:00 HKT 2022 # date -d "20211003 +90 days" Sat Jan 1 00:00:00 HKT 2022 # date -d "- $(awk -F. '{print $1}' /proc/uptime) second" +"%Y-%m-%d %H:%M:%S"
2021-12-18 21:55:55 # date Wed Jan 12 17:44:15 HKT 2022 # date -d "+90 days" Tue Apr 12 17:44:50 HKT 2022