cancel
Showing results for 
Search instead for 
Did you mean: 

Posting date to SAP via OData using Datepicker - timezone issue

0 Kudos

Hi All,

I am using the Datepicker control for getting the date from the user. (in Singapore timezone).

When i post the date into my oData service i see the date stored 1 day lesser..

var EtTransData = {

   __metadata:{

    type: "ns.type",

    properties: {

     Etdate: {

                     type: "Edm.DateTime"

                 },

    }

   },

  Etdate: new Date(sap.ui.getCore().byId("Current_Etdate").getValue()),

};

I understand that value comes out in the model is as "Fri Jun 20 2014 00:00:00 GMT+0800 (Malay Peninsula Standard Time)", but when in receive in the service class method create_entity it comes as 19/6/2014.

there is a timezone clash,, but not sure how to fix this ?

please help.

thanks,

Ram

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Found the way to fix:

var dateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern : "yyyy-MM-ddTKK:mm:ss" });

var lv_date_val = new Date(sap.ui.getCore().byId("Current_Etdate").getValue());

var dateStr = dateFormat.format(lv_date_val);

var EtTransData = {

   __metadata:{

    type: "ns.type",

    properties: {

     Etdate: {

                     type: "Edm.DateTime"

                 },

    }

   },

  Etdate: dateStr,

};


Worked well...

former_member225463
Participant
0 Kudos

This message was moderated.

Answers (0)