简体   繁体   中英

Datetime value on openerp and postgreSQL

Anyone know how to show same data in a datetime field in openerp 6.1 and postgresql?

When I create data at 7:00 (My timezone is +8:00) the view will show me that the data is 7/8/2015 7:00:00 but when I checked the database it became 6/8/2015 22:00:00

Even when I use

date : fields.date.context_today,

Any idea so the view and database datetime data will show the same result?

Times are saved in UTC so that Odoo/OpenERP can support multiple Timezone within a single database. As such all the code related to datetime (at server's level and web UI level) has been build with that assumption in mind. If you need to get the value in different timezone from the database, I believe it is for easier to calculate it from the field's value rather than getting Odoo/OpenERP to manage (storing is just only part of it) the time value in non-UTC timezone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM