linux date cheatsheet
Aug 6, 2022
Some quick handy formats that can be used with date command on linux.
Example:
date +'%d'
06date +'%m'
08date +'%Y'
2022date +'%m-%d-%Y'
08-06-2022date +'%m/%d/%Y %H:%M:%S'
08/06/2022 21:12:40date +'%m/%d/%Y %H:%M:%S %p'
08/06/2022 21:12:28 PMdate +'%x %T %p'
08/06/22 21:11:59 PMbonus (to print current epoch time):
date +'%s'
1659820538
Reference: Chapter10: Time, The Linux Programming Interface — Michael Kerrisk