Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Handling date in Python for Mongodb
from datetime import datetime, time
# getting date from form
dt = datetime.strptime(request.form['date'], '%Y-%m-%d')
# adding date for a record
record = {}
# need to add time (0,0)
record['date'] = datetime.combine(dt, time())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment