I'd like something like:

$ date --date="05/02/2012" "+2 days"

would give me "4 may" as output.. how ?

  • 1
    Did you try this command? {date -d "+2 days"} – Ramesh Feb 17 '14 at 17:19

Assuming GNU date, you have almost the right command in your question:

$ date --date="05/02/2012 +2 days"
Fri May  4 00:00:00 EEST 2012

To get the exact string 4 May, use this:

$ date --date="05/02/2012 +2 days" +"%e %b"
4 May

This will solve your problem:

date --date="05/02/2012 2 day"

You can use - to compute days before:

date --date="05/02/2012 -2 day"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.