Quantcast
Channel: SCN: Message List - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 8124

Edm.time stamp to 24 hour time in UI5

$
0
0

Hi All,

 

I have a time stamp field in EDM.time format (PT13H00M00S)  from OData .I need to show it as 24 hour time on my view like 13:00 .

 

I have followed this blog Working with OData Dates and Times

and able to get time as 01:00: PM .

 

Instead of 12 Hour time format I need to show it as 24 hour clock time.

I have used the below piece of code in my formatter for this conversion:

 

var timeFormat = sap.ui.core.format.DateFormat.getTimeInstance({pattern: "KK:mm:ss a"});

  var TZOffsetMs = new Date(0).getTimezoneOffset()*60*1000;

  var timeStr = timeFormat.format(new Date(value.ms + TZOffsetMs));

which returns 01:00 PM


Could any one help me how it can be achieved ?



BR

Sitara


Viewing all articles
Browse latest Browse all 8124

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>