For historical reasons, ORM recordsets handle date and datetime values using their strings representations, instead of actual Python Date and Datetime objects:
- odoo.tools.DEFAULT_SERVER_DATE_FORMAT
- odoo.tools.DEFAULT_SERVER_DATETIME_FORMAT
They map to %Y-%m-%d and %Y-%m-%d %H:%M:%S respectively. In the database, they are stored in date fields, but datetimes are stored without time zone, in UTC time.
To help handle dates, fields.Date and fields.Datetime provide a few functions, for example:
>>> from odoo import fields >>> fields.Datetime.now() '2017-11-21 23:11:55' >>> fields.Datetime.from_string('2017-11-21 23:11:55') datetime.datetime(2017, 11, 21, 23, 11, 55)
Dates and times are handled and stored by the server ...