on 07-28-2015 9:48 AM
Hi,
Good morning All,
I am getting the Flight data from Odata service. Up to here Its fine.
Departure time and Arrival time fields are getting time values but i would like see the time format like 7.50pm or 7.50am.
As of now I am getting the values as below as :
Departure time Arrival Time
PT09H00M00S PT17H21M00S
How to convert the Time format .Please let me know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
make sure you are mapping the right column and then also, make sure you take care of any offset time depending on your timezone
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In controller add below code and call that function in your view.
jQuery.sap.require("sap.ui.core.format.DateFormat");
Date : function (value) {
if (value) {
var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern: "yyyy-MM-dd"});
return oDateFormat.format(new Date(value));
} else {
return value;
}
},
I hope above code will help you.
with regards,
siva.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
I am writing the code in Index file only. Here must i write the function under template of Departure time and Arrival time ?? Please assist me.
//Create an instance of the table control
var tableo = new sap.ui.table.Table({
title: "Table with flight",
visibleRowCount: 7,
navigationMode: sap.ui.table.NavigationMode.Paginator
});
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Airline ID"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Airlineid"),
}));
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Connection ID"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Connectid"),
}));
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Airport From"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Airportfr"),
}));
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Airport To"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Airportto"),
}));
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "City From"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Cityfrom"),
}));
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "City To"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Cityto"),
}));
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Price"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Price"),
}));
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Departure Time"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Deptime"),
}));
tableo.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Arrival Time"}),
template: new sap.ui.commons.TextField().bindProperty("value", "Arrtime"),
}));
tableo.setModel(modelo);
tableo.bindRows("/FLIGHTSET");
tableo.placeAt("content");
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.