on 07-22-2019 12:58 PM
Hi,
After setting OData Model, date is shown in a UNIX Time stamp format.
date: "/Date(1500854400000)/
I want to display this date into readable form and also need to add 2 days on the date(date+2)
Do I need to convert this format to date format
Please help
You can follow the Date Formatter tutorial. In the Formatter, you can manipulate the Date and add 2 days and return the manipulated one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am binding these data in to a table, I have some condition for calculating the scheduled date, can we do this in DATE FORMATER with below condition base? I think it should be done before binding the data. right? but the issue is date is showing in timestamp format.
IF DistributionChannel = '10' OR DistributionChannel = '30' OR DistributionChannel = '50' . "
IF katr2 = '01'. "
ScheduleDate = ScheduleLineDate + 20.
ELSEIF IncoTerm1 = 'FCA' OR IncoTerm1 = 'FOB' OR IncoTerm1 = 'EXW'. "Inco Terms FCA, FOB or EXW
ScheduleDate = ScheduleLineDate + 10.
katr3 = '01'. "
ScheduleDate = ScheduleLineDate + 7.
katr4 = '01'.
ScheduleDate = ScheduleLineDate + 5.
ELSEIF ShippingType = '22' ShippingType = '23' OR ShippingType = '24'. "DG Shipment
ScheduleDate = ScheduleLineDate + 5.
ELSE.
ScheduleDate = ScheduleLineDate + 2
ENDIF.
ELSEIF DistributionChannel = '20' OR DistributionChannel = '40' OR
DistributionChannel = '60' OR DistributionChannel = '70' . "Only for
Domestic
ScheduleDate = ScheduleLineDate + 2.
ENDIF.
Hello,
No formatter is needed for your case.
If your data is stored I to an OData model, then when you do a getProperty() it returns a Date object. With javascy it will easy to add 2 days.
Then, if you want to show it in the view, you have to specify the type in the XML binding. Look at the answer of this post : https://answers.sap.com/questions/11878924/sapui5-xml-view-date-format.html
Regards,
Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should be able to use a formatter function, as mentioned above. Add parts to your .formatter function in xml view and pass the required fields (e.g. distribution channel, shipping type) and then elaborate your formatter function to add these conditions.
<Text text="{
part: [
'/Timestamp',
'/DistChannel',
'....'
],
formatter: '.formatter.date'
}"/>
date : function(date, field1, field2 ...){
<Write your conditions here..>
return strOutputDate;
}
Hope you can work with this information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.