1

We have an app that is being used by clients on different location. The app timezone is based on user location. We have an API that is deployed on a server which the timezone is UTC, and the database is in CST. This is causing issues when it comes to ordering parts. The code I have is:

total(case when (wo.Order <= current_timestamp + interval '1' day)

current_timestamp is in UTC, wo.Order is in CST, and user is in different timezone based on location. What is the best way to approach this problem? Should I make the server & DB same time or do I need to locate user location?

eyesun
  • 13
  • 6
  • 1
    What is the data type of `wo.Order`? `date`? `timestamp`? `timestamp with time zone`? `timestamp with local time zone`? – Justin Cave Apr 03 '19 at 22:54
  • I should have clarified. wo.Order is timestamp: 10-SEP-12 15.49.03 – eyesun Apr 03 '19 at 22:57
  • "database is in CST" ... why? Only use UTC in your backend and let the client convert that in the timezone they want. – Tom Apr 04 '19 at 00:10
  • I am guessing the DB is taking local time. – eyesun Apr 04 '19 at 00:31
  • 1
    It depends on many factors, maybe this answer will clear up this problem a bit: https://stackoverflow.com/questions/22305466/oracle-date-compare-broken-because-of-dst/22313422#22313422 – krokodilko Apr 04 '19 at 03:55

0 Answers0