Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Date format and Date picker

$
0
0

Hi,

I am having tough times with the date picker and the date pattern. I need to get the date in the format yyyyMMdd and I dont know how this can work.

 

I use a table and have the column bound to an Json data model like this,

 

 

itemsTable.addColumn(new sap.ui.table.Column({

   label: new sap.ui.commons.Label({text: oBundle.getText("DeliverDateTxt")}),

   template: new sap.ui.commons.DatePicker().bindProperty("value", "DeliverDate"),  

   sortProperty: "DeliverDate",

   filterProperty: "DeliverDate",

   width: "7%"

  }));

 

 

I also tried doing

 

 

itemsTable.addColumn(new sap.ui.table.Column({

   label: new sap.ui.commons.Label({text: oBundle.getText("DeliverDateTxt")}),

   template: new sap.ui.commons.DatePicker({

   

    value:{

     path : "DeliverDate",

     type : new sap.ui.model.type.Date({pattern:"yyyyMMdd"})

    }

   }),

   sortProperty: "DeliverDate",

   filterProperty: "DeliverDate",

   width: "7%"

   }));

 

the later gave me an error  -

error_dp.PNG

 

 

I need to send this date value back and I also tried like this,

 

 

var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern: "yyyyMMdd"});

    var tempDateFort = oDateFormat.format(backendData.itemData[i].DeliverDate.value);

    backendData.itemData[i].B1DDate = tempDateFort;

 

 

which gave me NanNaN  stuff..

 

can someone help me with this please ?. I am well aware of the datepicker example which I also tried using the defined pattern - may be someone can point to the mistake I am making - why do I get an error, what exact error does that mean "undefined is not a function" - tells me it is a Railway station without any name - well that is JS.

 

Any help would be highly appreciated.

thanks

Domnic


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>