SAP Fiori UI上关于时区Timezone的一些问题和解决方案

196 阅读1分钟

先说问题,我创建了一个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.

在这里插入图片描述