Answer the question
In order to leave comments, you need to log in
/Date(1671944676355)/ to dd.mm.yyyy?
I am using Worklist.view.xml and receive /Date(1671944676355)/
Text text="{Exdat}"
When I try
Text text="{path: 'Exdat',
type: 'sap.ui.model.type.Date ',
formatOptions:{pattern:'dd/MM/YYYY'}
}"
I receive the error message. How correctly convert date from JSON MODEL in such format dd/MM/YYYY?
Also I receive time in such format PT8H19M11S. I need to convert it in format hh:mm:ss?
Answer the question
In order to leave comments, you need to log in
I solved my problem:
In Worklist.view.xml I use formatter function:
Text text="{path:'Exdat', formatter: '.formatter.formatDate'}"
Then in formatter.js I write
formatDate: function (sValue) {
var date = new Date(parseInt(sValue.substr(6)));
var oFormat = sap.ui.core.format.DateFormat.getDateInstance({pattern: "dd.MM.YYYY"});
return oFormat.format(date);
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question