cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi All,

I created a table with XML view.

This is how i have binded.

<items>

<ColumnListItem>

<cells>

          <Text

            text="{empModel>Empno}" />

          <Text

            text="{empModel>Fname}" />

          <Text

            text="{empModel>Lname}" />

          <Text

            text="{empModel>Addrs}" />

          <Text

            text="{empModel>Desgn}" />

          <Text

            text="{empModel>Dob}" />

</cells>

</ColumnListItem>

    </items>



But my date format which is coming from gateway is in this format "2015-05-05T05:13:19.3167890".


I want to display it as 05-05-2015.


I also have a datepicker and in that datepicker date format is not selected in this format. So basically how i can perform the POST operations?


I am a beginner so if possible attach a simple code for reference.


Thanks in advance.

0 Likes
View Entire Topic
Former Member
0 Likes

Dear Experts,

Please help me with this issue.

I will be very grateful for this.

Please consider a model of data value 2015-05-05T05:13:19.3167890.


And please explain how to do this.

Eagerly waiting for you.

NagaPrakashT
Contributor
0 Likes

Hi Raghu,

You can write the below code in your formatter function

  1. formatDate : function(oDate) { 
  2.           var formatDate = new Date(oDate);
  3.           var date = formatDate.getDate();
  4.           var month = formatDate.getMonth() + 1;  // as month starts from 0
  5.           var year   = formatDate.getFullYear();
  6.           var ouput = year + "-" + month + "-" +date;
  7.      return  output;

Thanks,

Naga

Qualiture
SAP Mentor
SAP Mentor
0 Likes

IMO, a formatter is a bit overkill (it requires an extra function in the controller, and more importantly, it is only one-way).

The sap.ui.model.type.Date datatype seems way more versatile