SAPUI5 date time issue

May 23, 2017 at 04:29 PM


avatar image
Former Member

I am using a DateTimePicker but when sending data to the backend it subtracts 1h.

E.g. I chose 23.05.2017 17:20:27 and if I check the "Network" tab in Chrome it shows:


So 1h less and the same is shown in the Gateway so looks like a time zone problem.

Any idea why this is happening?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member May 23, 2017 at 05:57 PM

Hi Radek,

Please add UTC and set it to true in the declaration and check it that solves the issue.

new sap.m.DatePicker({
value : {
    path : "Date",
    type : new sap.ui.model.type.Date({
                style: "short",
                UTC: true

We also faced the same issue. In desktop we see one date and tablet we see previous date. With UTC = 'X' , the issue got resolved.

Fyi : Time zone calculation logic taken care at the backend.



10 |10000 characters needed characters left characters exceeded
Akhilesh Upadhyay May 24, 2017 at 08:58 AM

use strictParsing and UTC in formatOptions.

<DatePicker value="{path: 'date', type: 'sap.ui.model.type.Date', formatOptions: {pattern: 'dd.MM.yyyy', strictParsing: true , UTC: true}}">
10 |10000 characters needed characters left characters exceeded
Michael Lichtinger Jun 08, 2017 at 12:12 PM

Hi Radek,

you also could check/change the data type in ABAP Type Editor (SAP Gateway Service Builder) without changing anything in the Frontend (UI5).

1) Go to transaction SEGW (and open your relevant project)

2) Navigate to the Properties of your Entity Type and call the ABAP Type Editor from the property with the EDM Core Type "Edm.DateTime".

Note, for test purposes I added a property "Ledat" manually.

==> In this case, the Data Type is not suitable; we need the associated type "DATS".

3) Change the Associated Type

-> Mode: 2 Explicit Assignment

-> Category: D Data Element (already ok)

==> Associated Type: DATS

In my case this was working.



org-datatype.png (15.5 kB)
new-datatype.png (15.3 kB)
10 |10000 characters needed characters left characters exceeded
Skip to Content