How to set 'date' variable with correct format from xml

Hi,
I have this kind of response in xml:

<soapenv:Envelope xmlns">
soapenv:Header
<work:WorkContext </work:WorkContext>
</soapenv:Header>
soapenv:Body
<InvokeSBSEventRs xmlns=">
GET_OPEN_DATE

06-02-2020 00:00:00


</soapenv:Body>
</soapenv:Envelope>

I would like to get only date - 06-02-2020 from this response

  1. If iā€™m using this kind of script:
    var jsonData = xml2Json(responseBody);
    console.log(jsonData);
    var date = jsonData[ā€˜soapenv:Envelopeā€™][ā€˜soapenv:Bodyā€™].InvokeSBSEventRs.Parameters.Parameter;

console.log(date);
pm.globals.set(ā€œdateOfEnvā€,JSON.stringify(date)) ;

as a variable i have whole text
{ā€œ_ā€:ā€œ06-02-2020 00:00:00ā€,ā€œ$ā€:{ā€œnameā€:ā€œOPEN_DATEā€,ā€œtypeā€:ā€œoracle.jbo.domain.Dateā€,ā€œformatā€:ā€œdd-MM-yyyy HH:mm:ssā€}}

  1. If iā€™m using:
    let res = xml2Json(pm.response.text());
    pm.globals.set(ā€œdateOfEnvā€,_.get(res,ā€˜InvokeSBSEventRs.Parameters.Parameterā€™));

then as a result - null

Will be thankful for help

Ok i found answer :slight_smile:

pm.globals.set(ā€œdateOfEnvā€,JSON.stringify(date._)) ; ā†’ return only date