Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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
Comment

PREVIOUS NEXT
Code Example
Shell :: find files linux newer than 
Shell :: Cannot install, php_dir for channel "pecl.php.net" is not writeable by the current user 
Shell :: download specific folder from git 
Shell :: merge last three commits squash 
Shell :: gitignore 
Shell :: randomstring npm 
Shell :: avro for debian 
Shell :: linux add prefix to all files 
Shell :: ssh login using rsa 
Shell :: Update in fedora before installs 
Shell :: grep all lines after first match 
Shell :: how to get un merged branch git 
Shell :: install rust cargo 
Shell :: remove all gems installed 
Shell :: bash array append 
Shell :: delete missing files from svn 
Shell :: git delete origin branch 
Shell :: kazam recorder ubuntu 
Shell :: Flutter plugin not installed; this adds Flutter specific functionality. 
Shell :: docker connect usb device 
Shell :: linux services 
Shell :: linux set environment variable 
Shell :: how to delay the start of a program linux 
Shell :: how to run a .sh file 
Shell :: yarn ubuntu 
Shell :: git diff files only 
Shell :: git apply diff 
Shell :: copy files from local to host ssh 
Shell :: vim cut 
Shell :: pip install django invalid syntax 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =