example.py 529 B

123456789101112131415
  1. from dateutil.relativedelta import *
  2. from dateutil.easter import *
  3. from dateutil.rrule import *
  4. from dateutil.parser import *
  5. from datetime import *
  6. import commands
  7. import os
  8. now = parse(commands.getoutput("date"))
  9. today = now.date()
  10. year = rrule(YEARLY,bymonth=8,bymonthday=13,byweekday=FR)[0].year
  11. rdelta = relativedelta(easter(year), today)
  12. print "Today is:", today
  13. print "Year with next Aug 13th on a Friday is:", year
  14. print "How far is the Easter of that year:", rdelta
  15. print "And the Easter of that year is:", today+rdelta