shell scripts
Home shell scripts
How to Format Dates in Shell Scripts
When using dates in a shell script, you can format them like this: $(date +[format]) Here are some examples: $(date +”%Y%m%d)20080508 ——————– $(date +”%Y-%m-%d)2008-05-08 ——————– $(date +%D) which is shorthand equivalent for $(date +”%m/%d/%Y) 05/08/2008 To include time: $(date +%r)