cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Edm.time conversion in UI5

Former Member
0 Likes
10,036

Using a time picker with below code . The Server side of SAP is in EDM.string format as PT13H31M00S .

How is the value to be converted from time picker to required format.


  <DateTimeInput
  type="Time"

id="datepicker"

  placeholder="Enter Time ..."
  class="sapUiSmallMarginBottom" />


controller,js

var dtime = this.getView().byId('datepicker').getValue();

alert(dtime); //1:31 PM


Are there any functions to achieve the same ?



View Entire Topic
Former Member
0 Likes

I have put my code here : JS Bin - Collaborative JavaScript Debugging . How can i achieve the conversion ?

former_member182372
Active Contributor

            // Controller definition

          jQuery.sap.require("sap.ui.core.format.DateFormat");

            sap.ui.controller("local.controller", {

             

                  timeFormatter : sap.ui.core.format.DateFormat.getDateInstance({

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

    }),

           

                Get_time: function(oEvent) {

     

                  var dtime = this.getView().byId('datepicker').getDateValue();

                 

                 

                 

                  debugger;

alert(this.timeFormatter.format(dtime)); //1:31 PM

                 

                  //add seconds to the picker

                  //to be converted to PT13H31M00S

                 

                },

               

            });

Former Member
0 Likes

Maksim,

Is there something that i am missing to achieve via jsbin.?

JS Bin - Collaborative JavaScript Debugging

former_member182372
Active Contributor
0 Likes

getDateValue instead of getValue