Datetime in Openerp

            
All the datetime field in openerp are saved in the databse in the form of string :

record.birthday <type 'str'>

To convert string into datetime

till_datetime = datetime.strptime(record.birthday,"%Y-%m-%d")
1984-09-15 00:00:00 <type 'datetime.datetime'>

To convert datetime into string

till_datetime = till_datetime.strftime("%Y-%m-%d 23:59:59")
984-09-15 23:59:59 <type 'str'>

0 comments:

Copyright © 2013 SoftKul