up vote 7 down vote favorite
2
share [g+] share [fb]

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

link|improve this question

feedback

1 Answer

up vote 8 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
1983-08-06
link|improve this answer
1  
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
feedback

Your Answer

 
or
required, but never shown

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