Date

From wiki
Jump to navigation Jump to search
TIMESTAMP=`date +%s%N`
Pretty unique timestamp (seconds since 1-1-1970 and current nanosecond)
TIMESTAMP=`date +%Y%m%d_%H%M`
Common timestamp (Year, month, day, hour, minute)
YESTERDAY=`date -d "yesterday 13:00" +%Y%m%d`
DST safe way to get yesterday, just using yesterday between 23:00 and 01:00 can have unwanted result.