How do I convert datetime to date in Python

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

How do I convert a datetime.datetime object (for example, the return value of datetime.datetime.now()) to a datetime.date object in Python?

Answers

Use the date() method:

datetime.datetime.now().date()

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/3743222/how-do-i-convert-datetime-to-date-in-python

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils