Question

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

Was it helpful?

Solution

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top