I need to set a variable to a date that is 7 days from the current date. I need it in the format mm/dd/yy.
I’ve been using this to get the date in the right format:
set shortDate to do shell script "date +%m/%d/%y"
My question is, is there a way to add seven days to this command? I’ve done this:
set shortDate to (date (do shell script "date +%m/%d/%y")) + (7 * days)
I get the right date, but in the wrong format. I’m looking for a solution that will also include the leading zeros (like 08/05/07), the way that the first script does.
I’ve tried formating the second script, but I loose the leading zeros.
I am using this for now, but I wanted to know if it can be done with a shell script:
tell ((current date) + (7 * days)) to tell 100000000 + day * 1000000 + (its month) * 10000 + year as string ¬
to set shortDate to text 4 thru 5 & "/" & text 2 thru 3 & "/" & text -4 thru -1
Any suggestions would be greatly appreciated.
Thanks,
Brian