Converting unicode date to datetime object.

In a django template i had something like:

value="{{ query_date|date:'%d/%m/%Y' }}"

And in my view i wanted a date not an unicoded date.
So i did this in a view to parse the unicode and convert it to datetime object. 

from datetime import datetime
query_date_obj = datetime.strptime(query_date, "%d/%m/%Y")

Ciao!

Comments

Popular posts from this blog

Como configurar el control de directv para que funcione con el Tv

Las Tutucas y todo lo demás

Python Ipdb Cheatsheet