先說問題,我建立了一個Lead,建立時間14:21, TimeZone is UTC+8.
我期望的修改日志顯示的時間也是14:21, 結果錯誤的顯示成了CET time(有六個小時的差異).
解決方案
加上下面的時間戳轉換,把SAP Netweaver系統裡的時區設定考慮進去。
Make clear there is two Personal Time Zone in the backend (User Time Zone and System Time Zone).
Key Point
Make clear to the time convert during backend and frontend.
(1) In DB, it’s UTC time.
(2) In OneOrder, after select data from DB, we use below function, convert the UTC time to User Time Zone.
(3) In our program, we can’t transport User Time Zone out to UI directly, we should convert User Time Zone to UTC and update it_ausg. (it’s better for UI to convert UTC to your browser time)
(4) In the frontend, we can just use one logic, convert UTC to local time.