date
Common formats
date +"%H:%M:%S"
date +"%T"Matches ProjectDiscovery tools’ timestamp format:
date +"%Y-%m-%dT%H:%M:%S.%N%:z"Easy-to-read log format:
date +'[%d-%b-%Y %T]'
# [30-Sep-2025 16:20:08]Filename-safe UTC timestamp
date -u +"%Y-%m-%dT%H%M%SZ"
# 2026-09-09T213740ZSorts correctly as a string, has no characters that need escaping in a
filename (no :), and is unambiguous across timezones since it’s always
UTC.
$(now) alias
Uses the same filename-safe UTC format, so it plugs straight into a filename:
alias now='date -u +"%Y-%m-%dT%H%M%SZ"'touch "$(now)-filename-part2.ext"
# 2026-09-09T213740Z-filename-part2.extAs reusable functions
getDateTime () {
date +'[%d-%b-%Y %T]'
}
getTimestamp () {
date +"%Y-%m-%dT%H:%M:%S.%N%:z"
}