on 02-07-2014 1:43 PM
Hi Expert,
I want to convert date format as SAP input format. In SAPUI5 I have used below code:
<Label id="lbl1" text="Enter Date" visible="true" required="true" design="Bold"> </Label>
<DateTimeInput id="dtDT" type="Date" change="dateFunc"></DateTimeInput>
The input format is: FEB 7,2014.
I need to convert this format to YYYY/MM/DD and display in a alert method as a message.
How to convert the input date format into YYYY/MM/DD format.
Any possible sollution would be accepted gratefully.
Thanks & Regards,
Arindam Samanta.
Hi Arindam,
You could use:
https://sapui5.netweaver.ondemand.com/sdk/docs/api/symbols/sap.ca.ui.model.format.DateFormat.html
var dateFormat = sap.ui.core.format.DateFormat.getDateInstance({pattern : "YYYY/MM/DD" });
var dateFormatted = dateFormat.format(yourDate);
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
the developer guide has a nice description at the bottom of the page SAPUI5 SDK - Demo Kit too.
Regards, Frank
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arindam,
Use split function to seperate the date. Use two times split function. First time seperate the comma(,) and second time for space. So you will get in an array. Use them to display in your format.
how to split a string in javascript - Stack Overflow
For example, Use like this.. array[0]+"/"+array2[0]+"/"+array2[1] in the output format.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arindam,
Here is a working sample you may refer to..
You may have a look at some more useful Date format examples here
If you are consuming date from OData service , this blog by John Patterson is a must read.
Regards,
Atanu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.