Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example, I have date: 4 August 1993 and I want to add 348 days to it, how can I do it in bash?

share|improve this question

3 Answers 3

up vote 17 down vote accepted

Just use the date command with -d option:

$ date -d "1983-08-04 348 days"
Tue Jul 17 00:00:00 BST 1984

You can change the output format if you want:

$ date -d "1983-08-04 2 days" +%Y-%m-%d
share|improve this answer
You can use the OP's date format, too: date -d "4 August 1993 348 days" +"%d %B %Y" –  Dennis Williamson Sep 23 '09 at 16:54
According to man date: %F full date; same as %Y-%m-%d –  jperelli May 2 '12 at 21:58

In bash on Mac OS X, you can do this:

date -j -v +348d -f "%Y-%m-%d" "1993-08-04" +%Y-%m-%d

Output: 1994-07-18

share|improve this answer

Here is a little more complex usage of this:

for i in `seq 1 5`;
  date -d "2014-02-01 $i days" +%Y-%m-%d;

or with pipes:

seq 1 5 | xargs -I {} date -d "2014-02-01 {} days" +%Y-%m-%d
share|improve this answer

Your Answer


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.