cancel
Showing results for 
Search instead for 
Did you mean: 

How to display formatted Date in Table column?

Former Member
0 Kudos

Hi all,

In the SAPUI5 application, I want to display date in MM/dd/yyyy format in a table column.

I am using SAP NW Gateway service (OData) to fetch data from backend.

And I have created SAPUI5 application using JavaScript model with library (sap.ui.table).

At present, the date is been displayed in the table/column in below format.

Here, is the code snippet for displaying the date.

Can anyone please guide me on this.

Thanks,

Mistry Wasim

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

use, type: new sap.ui.model.type.Date({pattern: "MM/dd/yyyy hh:mm"})

http://stackoverflow.com/questions/23537581/formatting-a-date-from-an-odatamodel-in-a-sapui5-table

Former Member
0 Kudos

Hi Santhosh,

Thanks, I had a look at the link but got stuck at the formatter logic.

Could you help me on that please?

Thanks,

Mistry Wasim

santhu_gowdaz
Active Contributor
0 Kudos

template: new sap.ui.commons.TextView().bindProperty("text", {
  path: "Endda",
  type: new sap.ui.model.type.Date({pattern: "MM/dd/yyyy"})
})

Not working for you?

Former Member
0 Kudos

Hi Santhosh,

Your last response worked!

Thanks a lot!

Thanks,

Mistry Wasim

santhu_gowdaz
Active Contributor
0 Kudos

Here is the example-Edit fiddle - JSFiddle

Answers (2)

Answers (2)

Private_Member_15166
Active Contributor
0 Kudos

Check out this thread.

former_member182862
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi Dennis,

Thanks for the reply.

Could you please help me with the related library for using sap.ui.model as I tried it before posting the query.

Thanks,

Mistry Wasim