Function 7 days ago

Please tell me how can I wirte a function to return the date 7 days ago by using calendar command? :confused:

Python alternative

#!/usr/bin/python
import datetime
delta = datetime.timedelta(days=7)
today = datetime.datetime(2006,10,31)
seven_days_ago = today - delta
print seven_days_ago 

output:

2006-10-24 00:00:00