sap.ui.model.type.Date – format Date object to HH:mm

new Date();
//Expected output: Tue Jun 27 2023 15:08:00 GMT+0200

var oTypeDateUTC = new sap.ui.model.type.Date({ UTC: true, pattern: 'HH:mm'});
oTypeDate.formatValue(new Date(), "string");
//Expected output: '13:08'

var oTypeDateNoUTC = new sap.ui.model.type.Date({ pattern: 'HH:mm'});
oTypeDateNoUTC.formatValue(new Date(),"string");
//Expected output: '15:08'

Leave a Reply

Your email address will not be published. Required fields are marked *