← All tips

Bash: create a timestamp string

bashbasics

Useful for log files and build artifacts.

ts=$(date +%Y%m%d-%H%M%S)
echo "$ts"