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.
Request clarification before answering.
I have used the following code in the controller where I make my table in:
var datetimecol = new sap.ui.table.Column({label: "{i18n>Date_Time}", editable: false,
template: new sap.ui.commons.TextField( {
value: {
path: "DATETIME",
formatter: sap.ui.demo.table.util.Formatter.date,
},editable : false,
}),
sortProperty: "Date_Time", width: "12em" });
oTable.addColumn(datetimecol);
This creates a column and adds it to the table.
This is the code I use for my formatting of the date-time:
date : function(fValue){
if(fValue != null){
fValue = new Date(parseInt(fValue.substr(6)));
var sLocale = sap.ui.getCore().getConfiguration().getLanguage();
var oBundle = jQuery.sap.resources({url : "i18n/messageBundle.properties", locale: sLocale});
var dateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern : oBundle.getText("DateTimeFormat") });
fValue = dateFormat.format(fValue);
return fValue;
}
return fValue;
},
I also check the locale so it automatically adjusts to the right time.
The i18n/messageBundle.properties content is:
#DateTime format
DateTimeFormat=dd/MM/yyyy HH:mm:ss
I've done this so that it's possible to change the date time for America or Europe or anywhere else.
I hope this code can be of use to you.
Kind regards,
Max
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.