Skip to Content

Set value of DateTimeInput control from OData

Hello,

I'm trying to insert a date which is a json response to read() method:

var oDateTimeInput = new sap.m.DateTimeInput({
     type: "DateTime"
});
oDateTimeInput.setValue(results[0].DiscontinuedDate);

Here how looks the json response:

{results:
[
     {
     DiscontinuedDate: "Sat Oct 01 2005 03:00:00 GMT+0300 (Jerusalem Time (summer))",
     ID: "1",
     Description: "One"
     } ]}

I get the following error:

Format Error: value property Sat Oct 01 2005 03:00:00 GMT+0300 (Jerusalem Time (summer)) does not match with valueFormat M/d/yyyy, h:mm a of Element sap.m.DateTimeInput#updateFormReleaseDate

How do I insert the value? How do I make DateTimeInput control accept the value?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 20, 2015 at 04:04 PM
    1. oDateTimeInput.setValue( new Date( results[0].DiscontinuedDate) ); 
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2015 at 01:31 PM

    Hi,

    Can u check this link UI5 Programming Exampleswhich contain date format JS BIN example.

    Ref:

    11. Formatter Examples:


    Thanks,

    Pradeep

    Add comment
    10|10000 characters needed characters exceeded