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