Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)
Solved

DatePicker Format Value

Hi everybody,


if I use the the DatePicker, I get the following string in the ajax_value:


"Tue Jul 21 2015 00:00:00 GMT 0200 (Mitteleuropäische Sommerzeit)"


I just want 20150721 or 21.07.2015. I tried with different options, but I always get the wrong value format. 


regards,

Daniel



pdf
(93.8 KB)

Hi Daniel,


the Formatters are just transforming the values on the GUI (model-view-controller principle).


Setting the valueFormat property to yyyyMMdd (as you did) should give you the wanted result.

How do you read the data from the DatePicker? Do you use data binding? You can also always access the field value directly, like in this example:


var value = myDatePickerObject.getValue();


Best regards

Christoph 


1 person likes this

Hi Christoph,


I read the data with "var buchungsdatum = datePickerBuchungsdatum.getDateValue();"


But the string is like this ""Tue Jul 21 2015 00:00:00 GMT 0200 (Mitteleuropäische Sommerzeit)"


regards,

Daniel

Hi Daniel,


please try:


var buchungsdatum = datePickerBuchungsdatum.getValue();


Best regards

Christoph


1 person likes this

Hi Christoph,


great! Now it's working.

I have not looked at the methods borrowed from class sap.m.InputBase

https://sapui5.netweaver.ondemand.com/sdk/#docs/api/symbols/sap.m.DatePicker.html

Sometimes it could be so simple.


best regards,

Daniel



Login or Signup to post a comment