Skip to Content
0
Jul 10, 2015 at 12:59 PM

How to convert the Object to Number in SAPUI5

842 Views

Hi All,

i am trying to chnage the date format using Formatter .js .

<Text

text="{

path:'DelivDate',

formatter:'sap.ui.custom.prtracking.util.Formatter.date'

}"/>

The above code is used to call the formatter from my xml view.

this is my code, i am calling the Formatter (js) from this view. but the object which am passing to formatter is raw type i guess. i am getting the response like Nan0,Nan .

this is my Formatter code:

date : function (value) {

alert("inside date "+value);

if (value) {

var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern: "MMM dd,YYYY"});

return oDateFormat.format(new Date(value));

} else {

return value;

}

},

i need to convert the value to number type. how do i acheive this?

Thanks

JK