cancel
Showing results for 
Search instead for 
Did you mean: 

DatetimePicker

former_member220538
Active Participant
0 Kudos

Hi,

I have a requirement to get the number of hours worked.So is it possible to get only the hours and minute avoiding the AM/PM  in the DateTimeInput ?

If so how to do it.Please suggest me if any alternatives is there.

Regards,

Jeffin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The below code may be what you want, I cannot take the credit here as it comes from the test page for the DateTimeInput Object

dti1 = new sap.m.DateTimeInput({

  placeholder : "Time Picker",

  type : "Time",

  valueFormat : "HH:mm",

  value : "11:23",

  displayFormat : "H'h' m'm'",

  change : function(e) {

  page.setTitle(e.getParameters().newValue);

  }

See the below link and look at the Duration Field

sap.m.DateTimeInput

If you not downloaded the SDK it worth doing so as there loads of test pages there.

All under the folder test-resources\sap\m

Martin

former_member220538
Active Participant
0 Kudos

Hi,

Thanks a lot it worked as i expected.

Answers (1)

Answers (1)

former_member182650
Contributor
0 Kudos

Hi Jeffin,

Could you post your code¿? This page has a lot of examples. You could set hour:minute and its value is binded to a TextView:

sap.m.DateTimeInput

Kind regards

former_member220538
Active Participant
0 Kudos

Hi,

Thanks for the reply.I am new to UI5 development,doesn't know much about it.Actually i want to get the hours and minutes from the user.Using sap.m.DateTimeInput i am able to get the time but i doesn't want to display the AM/PM field in the popup.I want only hours and minutes to be displayed.

<script type='text/javascript'>

  var app = new sap.m.App("myapp", {

  initialPage : "page1"

  });

  var txt = new sap.m.DateTimeInput("time",{type : sap.m.DateTimeInputType.Time});

  var lab  = new sap.m.Label({text: "Working Time"});

  var line = new sap.m.HBox({

  items : [lab, txt]

  });

  var page1 = new sap.m.Page("page1", {

  title : "Login",

  backgroundDesign : sap.m.PageBackgroundDesign.Transparent,

  content : [line],

  });

  app.addPage(page1);

  app.placeAt("page");

  </script>

Thanks

Jeffin