on 2016 Aug 26 9:10 AM
Hey Experts!
I have a problem with my date formatter on my View. My date should be formatted according to the user profile. I get my date time from a database by a oDataModel like: Fri Aug 26 2016 02:00:00 GMT+0200 (W. Europe Daylight Time)
and as i mentioned i want to fomat it accoring to the user profile with this code snipped:
// For date/time values require the DateFormat class
jQuery.sap.require(
'sap.ui.core.format.DateFormat'
)
// Instantiate the date, time, datetime classes, without a parameter or based on a certain style (either 'short', 'medium' or 'long')
var
oDateFormat = sap.ui.core.format.DateFormat.getDateInstance();
// Use any of the variables above to format a date or time value (using JavaScript "Date" objects):
oDateFormat .format(
new
Date());
The problem is my oData date is a string and not a js-object which i need to format my oData model output correctly.
Have you an idea to fix this problem? fyi i want to implement this datefommater into a ColumListItem control which used as a template to bind my models to a table below this text you will see how i do it at the moment:
Here is how my template looks like with a working but static date time formatter 1# (i want replace this static fomatter with the new method above):
1# My static formatter
2# My template for binding
Best Regards,
Danilo
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
29 | |
9 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.