chula.ecalendar – Calendar helper

Simple module to aid in working with calendars

class chula.ecalendar.Calendar(year=None, month=None)

Calendar object consisting of a list of datetime.datetime objects.

>>> from chula import ecalendar
>>>
>>> # Calendar for this month
>>> c = ecalendar.Calendar()
>>>
>>> # Calendar for a specific year/month
>>> c = ecalendar.Calendar(year=2010, month=2)
>>>
>>> # Print out the last two weeks of the month
>>> for i, week in list(enumerate(c))[-2:]:
...     print 'Week', i + 1
...     for day in week:
...         print day.strftime('%Y/%m/%d')
Week 3
2010/02/15
2010/02/16
2010/02/17
2010/02/18
2010/02/19
2010/02/20
2010/02/21
Week 4
2010/02/22
2010/02/23
2010/02/24
2010/02/25
2010/02/26
2010/02/27
2010/02/28

Previous topic

chula.db.functions – Database helper functions

Next topic

chula.error – Custom exceptions

This Page