Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2806

oData time formatting in sapui5

$
0
0

Hi Experts,

 

I am not able to format oDate time in sapui5 application.

 

TimeOfMeasur:"PT18H25M00S"


formatter.js

 

Time: function(fValue) {

  if (fValue) {

  var date = new Date(fValue.ms);

  var timeinmiliseconds = date.getTime();

  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(timeinmiliseconds + TZOffsetMs));

  return timeStr;

  }

else

{

  return fValue;

  }

  },

 

XML View

 

<Text text="{path:'TimeOfMeasur',formatter:'base.format.Formatter.Time'}"/>

 

I tried both the ways and i am getting Invalid Date.

 

var date = new Date(fValue.ms); //Invalid Date

and

var date = new Date(fValue); //Invalid Date



Regards,

Ashitha


Viewing all articles
Browse latest Browse all 2806

Trending Articles



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