Skip to Content

Date Format in XML View

Hi,

I am trying to format the date in my XML view with the following code

<Table:Column width="150px">
  <Table:label>
  <Label text="Posting Date" />
  </Table:label>
  <Table:template>

<Label text="{path:'FinModel>PstngDate',

type: 'sap.ui.model.type.Date',

formatOptions: {pattern: 'yyyy/MM/dd'}

}" />

  </Table:template>
  </Table:Column>

The data in 'FinModel>PstngDate' is 2014-01-08T00:00:00


I want this to be displayed as 08/01/2014

But the above code gives me the error.

Uncaught TypeError: d.getTime is not a function

Any help would be highly appreciated.

Regards,

Firoz.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2016 at 07:59 AM

    Hi Firoz,

    thats because this type expects a javascript date but it gets an odata Datetime type.

    I suggest using SAPUI5 SDK - Demo Kit instead. It is just slightly different.

    OR:

    You can request your data from the OdataModel as json. That should work too:

    SAPUI5 SDK - Demo Kit

    Just set json to true.

    Greetings

    Nils

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 28, 2016 at 10:21 AM

    Firoz,

    this documentation may be helpful from sap.m date formats

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.