Skip to Content
0
Former Member
Oct 05, 2016 at 01:46 PM

Edm.Time format Issue while posting from UI5 App using XSODATA service

5647 Views

Hi Experts,

My requirement was to get the time value from TimePicker and Post this using XSODATA service.

I am able to insert record in the table.

Now the issue was, it always taking as AM as default but not taking PM values.

Here is my code:

<TimePicker

id="TP4"

value="20:00"

valueFormat="HH:mm" class="sapUiSmallMarginBottom"

displayFormat="HH:mm"

change="handleChange"

placeholder="Enter time"/>

Controller.js

var format1 = sap.ui.core.format.DateFormat.getDateInstance({

pattern : "PThh'H'mm'M'ss'S'"

});

var fromHrMinVal = this.byId("TP4").getDateValue();

var fromHour = new Date(fromHrMinVal).getHours();

var fromHourMin = new Date(fromHrMinVal).getMinutes();

var d = new Date(fromDate.getDateValue());

d.setHours(parseInt(fromHour),parseInt(fromHourMin));

var oEntry = {};

oEntry.StartTime = format1.format(d);

Checked below link as well..

http://scn.sap.com/community/developer-center/front-end/blog/2013/04/28/working-with-odata-dates

Thanks in Advance,

Venugopal