I'm trying to call a Webservice with a DateTime format like this : "\/Date(x)\/"
where x
is the millisecond value since 1970.
How can I generate a DateTime in this format?
Here is what i've done :
dateValidation_long = dateValidation_string.getTime();
String a = '\\/Date(';
String b = ')\\/';
modifierEntiteDeFacturation3C_request.dateValidation = a + dateValidation_long + b;
Here is the result in my console :
\/Date(1505904139000)\/
Then, i'm trying to JSON.serialize this date, to send it via a Webservice, and this is the result :
dateValidation":"\\/Date(1505904534000)\\/"
The webservice response is not OK because the format is different as expected :
DateTime content '\/Date(1505904139000)\/' does not start with '\/Date(' and end with ')\/' as required for JSON.