Hi, Running into a problem with date and month...
------------------------------------------------------------------- #!/bin/bash function example { rptdate=$(date +%Y-%m-%d -d "$1 -6 months") echo "6 months ago from $1 is ${rptdate}" } example 2012-09-30 example 2012-10-31 example 2012-10-30 example 2012-11-30 example 2012-12-01 example 2012-03-31 ------------------------------------------------------------------- 6 months ago from 2012-09-30 is 2012-03-30 ****6 months ago from 2012-10-31 is 2012-05-01*** 6 months ago from 2012-10-30 is 2012-04-30 6 months ago from 2012-11-30 is 2012-05-30 6 months ago from 2012-12-01 is 2012-06-01 *****6 months ago from 2012-03-31 is 2011-10-01* It seems that its running into the issue that if the 6 months ago doesn't have the same amount of days, its falling into the next month. Is there a way to tell it to instead just use the last day of the month? Thanks, Tuc