1 2 3 4 5 6 7 8 9 10 11 | from mx.DateTime import *
from datetime import datetime
date = now()
month_ids = []
while not (date.month == 4 and date.year == 2004):
month_ids.append((date.strftime('%b%y'),date.strftime('%B %Y')))
date = date + RelativeDateTime(months=-1)
print month_ids
#date.days_in_month
|
More like this
- FeaturedModelChoiceField by willhardy 3 years, 9 months ago
- DropDownMultiple widget by marinho 5 years ago
- Month / Year dropdown widget by gregb 3 years, 9 months ago
- Timezone choice field for select box by jmunro 1 year, 2 months ago
- CustomChoiceField, Selectable label field version of ModelChoiceField by mauro 5 years, 2 months ago
Comments