On Fri, Dec 31, 2010 at 5:53 AM, Malte Beckmann
<[email protected]> wrote:
> I got a models.DateField and would like to extract months and years from
> that field so I can do calculations like a 'day in month' in a 'for month in
> months' loop in a 'for year in years' loop. How can I extract that info from
> a datefield? I have tried to read code written by others but their solutions
> are not very obvious to me.

The value of a Datefield is a Python datetime.date object. To see the
attributes of datetime.date instances, which include what you want
here, see the Python datetime documentation:

http://docs.python.org/library/datetime.html#date-objects


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to