Skip to Content
avatar image
Former Member

Date value is getting reduced by one day while passing it from UI5 application to Gateway system

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Oct 05, 2017 at 12:50 PM

    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}
     }
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 04, 2017 at 10:01 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Rahul,

      Strange it is not working for you,
      can you please share your code snippet and request payload of network tab in debug mode.

      Regrads,
      Amit

  • Oct 05, 2017 at 04:57 AM
    -1

    You can also use the SY-DATUM in ABAP side. SY-DATUM gives the current date.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 09, 2017 at 12:18 PM

    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

    Add comment
    10|10000 characters needed characters exceeded