Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'd like something like:

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

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

share|improve this question
1  
Did you try this command? {date -d "+2 days"} –  Ramesh Feb 17 at 17:19
add comment

2 Answers

up vote 5 down vote accepted

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
share|improve this answer
add comment

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"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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