linux - n days ago from a given date on command line -


for example, given date '2016-12-31', n 2, expected output '2016-12-29'.

survey date command , n days ago current date easy:
date -d "2 days ago" +%y-%m-%d

just mention date want extract 2 days from:

$ date -d "2016-12-31 2 days ago" +%y-%m-%d 2016-12-29 

or bit better grammatically-wise:

$ date -d "2016-12-31 -2 days" +%y-%m-%d 2016-12-29 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -