1

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?

Vivek S.
  • 19,945
  • 7
  • 68
  • 85
  • what's the exact data type of that field ? – Vivek S. Oct 07 '15 at 08:37
  • 1
    we cannot change the date value in database, i.e., database stores the value in UTC format. So, when you are accessing the value from DB it returns the UTC value + timezone (that is set on your browser/openerp server). for eg: Even if you apply some operations on date value and made it as 7:00:00 to store in DB, then while retrieving it adds 7:00 + 5:30 (IST timezone). – shravan cherukuri Oct 09 '15 at 15:36

1 Answers1

1

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.

Jainik Patel
  • 2,284
  • 1
  • 15
  • 35
  • Patel : So what do I supposed to do when I want to filter data by date? in my example when I filter data by date 7/8/2015 the data won't show up. It showed up on 6/8/2015 – Sembarangan Oct 13 '15 at 03:46