on 10-04-2017 10:36 AM
Hi Experts,
I have a UI5 application where i am passing a date value to a GET_ENTITYSET method of OData (V2) service. Data type of property is Edm.DateTime.
The problem is, in gateway system while debugging GET_ENTITYSET method, i observed that date value is getting reduced by one day. I suppose the problem is with timezone conversion because the UI5 client and gateway server are in different timezones.
Kindly help me with this problem.
Thanks,
Rahul
Hi Rahul,
you may set formatOptions:{UTC:true} when working with Time between frontend and backend, so that the Timezone will be calculated correctly by UI5.
Ex:
{
path: 'ChangeDateTime',
type: 'sap.ui.model.type.DateTime',
formatOptions: {UTC:true}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've just noticed that you're passing the date from the controller.
You can set the parameter UTC to true in the method "format".
I borrow the example above from Amit:
var dateFormat = sap.ui.core.format.DateFormat.getDateInstance({
pattern: "yyyy-MM-dd"
});
oDate = dateFormat.format(new Date(yourDate), true);
https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.core.format.DateFormat
Hi Rahul,
There is some time zone issue while passing Date to backend, however you can use below trick to pass same date to backend.
var dateFormat = sap.ui.core.format.DateFormat.getDateInstance({
pattern: "yyyy-MM-dd"
});
oDate = dateFormat.format(new Date(yourDate));
oDate = oDate + "T00:00:00";
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The ui5 program send date in UTC +00H00 so in the back end system you should make the conversion when you parse the date with the statement
Convert date time....
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can also use the SY-DATUM in ABAP side. SY-DATUM gives the current date.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We don't want current date, we want the same date which was passed from UI5 client application.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.