on 05-01-2014 10:23 AM
Hi SAPUI5 experts:
I'd like ask 2 things regarding the control: sap.m.DateTimeInput
1: Here is I want to do: show the current date (May 1, 2014) in the control in format as "01-05-2014". But by default the following code shows "May 1 2014". How can I show it as "01-05-2014"?
var oDateTimeInput = new sap.m.DateTimeInput({});
oDateTimeInput.setDateValue(new Date()); //shown as "May 1 2014"
2. Can someone explain what difference is between the following settings of DateTimeInput?
ValueFormat
DisplayFormat
Please write a short code example.
Thanks very much in advance!
Br,
Dong
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
to understand ValueFormat and DisplayFormat, you can refer this example from ui5 testsuite sap.m.DateTimeInput and check the source code.
in one of the example, this is how valueformat and displayformat is used.
// free style date value assingment according to valueFormat
dti3 = new sap.m.DateTimeInput({
value : "05-29, 2012",
valueFormat : "dd-MM, yyyy",
displayFormat : "dd MMMM, yyyy",
width : "20%",
change : function(e) {
console.log(dti3 + " : " + e.getParameters().newValue + " # " + e.getParameters().newDateValue);
}
}),
also in both cases, Default value is taken from locale settings.
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sakthivel and Chandra,
Thanks very much for your quick answers. They helped to solve teh issue.
Nice day!
Dong
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
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.