0

I have created a table using SAPUI5 and I get the data to the table using ODATA service. BUt, I have a column which is of a type DATE and the format is something like this "Thu Jan 13 2011 01:00:00 GMT+0100 (Mitteleuropäische Zeit)".

I tried to google and I found this blog which is really nice.

But here I see also a jsbin example where only a single data value has been used. But I need to select one whole column "Businessdate" and format it to something like this ´13.01.2014´. Any suggestions?

The data in my source table is of type DATE.

Thanks

Sangamesh Hs
  • 1,447
  • 3
  • 24
  • 39
  • Does this answer your question? [How to Add Date / Time from OData Service Correctly to UI?](https://stackoverflow.com/questions/47593990/how-to-add-date-time-from-odata-service-correctly-to-ui) – Boghyon Hoffmann Jul 12 '21 at 15:34

1 Answers1

2

I have updated your jsbin example: http://jsbin.com/cika/4/edit

The changes I've made:

  1. I have mimicked your ODate date's ISO8601 format by just setting it to the current date:

    oModel.setData({
        dateValue:  new Date() // I.e. Mon Feb 24 2014 17:35:22 GMT+0100 (W. Europe Standard Time)
    });
    
  2. Just let the DatePicker control format it to your desired output format ('dd-MM-yyyy'):

    new sap.ui.commons.DatePicker("date2",{
        width: "10em",
        value: {
            path: "myModel>/dateValue",
            //the format information 
            type: new sap.ui.model.type.Date({pattern: "dd.MM.yy"})
        }
    });
    

Hope this helps!

Qualiture
  • 4,900
  • 7
  • 27
  • 38