cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

francesco_alborghetti
Active Participant

I think you have to change your dateFormat pattern:

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

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

});

try to use

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

please refer to this link for right symbols (hh is 12 hours with zero padding, HH is 24 hours with zero padding)

UTS #35: Unicode LDML: Dates

Former Member
0 Kudos

Hi Francesco,

Your right... It is working fine..

Have one more question

We are monitoring the time entered by user and need to take action at the specified time.

Our application used by Multiple regions so (HCP)HANA procedures monitor the time. I think time is stored in the tables default as GMT time. So do you want me to convert the time into GMT whenever i insert record? or procedure will take care?

awaiting for your reply..

Thanks,

Venu

francesco_alborghetti
Active Participant
0 Kudos

Hi Venu,

You should post this question to Hana community for a better answer.

To my knowledge HANA stores dateTime data without time zone info, you can check here for more info:

Data Types - SAP HANA SQL and System Views Reference - SAP Library

So timezone info should be stored separately,

or your procedure should  call LOCALTOUTC HANA built in function before storing the data

or you should do it on application level

Answers (0)