my_date=$1 #Here i want to two diffrent dates
## 3 Days before
##date14query=$mydate - 4 (it will be 2010-01-28)
##date24query=$mydate +4 (it will be 2010-01-05)
I've done this a bunch, but don't have anything handy. Usually I'd recommend you create a hash with the months and how many days they have (don't forget a special exception for leap years). Then just subtract the number you want from the current day, if that number is less than 1, add the negative number to the previously created hash with the number of the days in it and this will give you the difference.