Answers for "how to check date is older than x days in shell script"

0

how to check date is older than x days in shell script

datetime='2016-08-31T15:38:18Z'
timeago='90 days ago'

dtSec=$(date --date "$datetime" +'%s')
taSec=$(date --date "$timeago" +'%s')

echo "INFO: dtSec=$dtSec, taSec=$taSec" >&2

[ $dtSec -lt $taSec ] && echo too old
Posted by: Guest on June-18-2020

Code answers related to "how to check date is older than x days in shell script"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language