Reputation: 41
How to format the Date and time in sapui5 application. Formatter option is not working. Please suggest some idea. Shared the tried code also.
my code :
new sap.m.ObjectIdentifier({ width : "100%" ,
title : "{DocDate}",
type: new sap.ui.model.type.DateTime({pattern: "yyyy-MM-dd"})
})
I need result like this : 2020-09-08
If anyone has an idea or a suggestion, I'd be more than thankful if you let me know.
Upvotes: 2
Views: 10820
Reputation: 11
To format a date in sapui5 this works as well. Check in console.
// DateFormat required from the module "sap/ui/core/format/DateFormat"
DateFormat.getDateInstance({pattern: "yyyy-MM-dd"}).format(new Date());
Upvotes: 1
Reputation: 1301
Here you go:
new sap.m.ObjectIdentifier({
width : "100%" ,
title : "{ path: 'DocDate' , type: 'sap.ui.model.type.Date', formatOptions: {pattern: 'yyyy-MM-dd'} }"
});
Upvotes: 4