date

The purpose of this document is to explain the Linux date command.

ISO 8601 Now

now=$(date +"%Y%m%d%H%M%S") > 20130311155658 now=$(date +"%Y-%m-%dT%H%M%S") now=$(date --iso-8601=seconds --utc) > 2013-03-11T16:00:08+0000 now=$(date --iso-8601 --utc) > 2013-03-11

Date math

today_date=( date +'%Y-%m-%d' ) yesterday_date=$( date --date="$today_date -1 day" +%Y-%m-%d ) date -d +7day +"%a, %d %b %Y %H:%M:%S GMT" # RFC 1123 date 7 days from now

[Edit]