Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Date Format displaying blank.

Hi Experts,

I searched all threads & couldn't find solution for date formatting issue.

I'm trying to display date with date formatter function in formatter.js file.

My display field is written as below.

<ObjectAttribute text="{StartDate, formatter : '.date'}"/>

while my formatter.js is written as follows.

jQuery.sap.require("sap.ui.core.format.DateFormat");

sap.ui.define([

  ], function () {

"use strict";

return {

currencyValue : function (sValue) {......... },

//Date function to display date in mm/dd/yyyy format

date: function(value){ //Date(1451635200000)/

var value1 = value.substring(7,20);

var oDateFormat = sap.ui.core.format.DateFormat.getDateInstance(

{value1: "dd/MM/yyyy"}); //Returns a DateFormat instance for date and time

value = oDateFormat;

return value;

}

};

But it is displaying as blank. Thanks in advance.

Sameer

Tags:
Former Member
replied

Hi Sameer,

You can try format options in the View code. Below is an example-

<ObjectAttribute text="{ path: 'StartDate', type: 'sap.ui.model.type.Date', formatOptions: { style : 'long' }}"/>

BR.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question