# XML to Datetime

**URL:** <https://forum.ansible.com/t/xml-to-datetime/36287>\
**Category:** Ansible Project\
**Created:** [February 3, 2022, 9:13pm UTC](https://forum.ansible.com/t/xml-to-datetime/36287 "2022-02-03T21:13:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amarpreet\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@Amarpreet\_Singh](https://forum.ansible.com/u/Amarpreet_Singh)\
**Post date:** [February 3, 2022, 9:13pm UTC](https://forum.ansible.com/t/xml-to-datetime/36287/1 "2022-02-03T21:13:45Z")

</div>

Looking for help to convert XML output of a ssl certificate and get date out of it.  
Then compare and check if that cert has expired or not.

output

“stdout”: “{"not-valid-after": "Apr 20 17:36:03 2022 GMT"}”,  
“stdout\_lines”: [  
“{"not-valid-after": "Apr 20 17:36:03 2022 GMT"}”  
],  
“stdout\_xml”: “Apr 20 17:36:03 2022 GMT\n”

I am looking to change the red highlighted line in datetime format.

---

<div class="post-metadata">

**Author:** ![Rilindo\_Foster1](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@Rilindo\_Foster1](https://forum.ansible.com/u/Rilindo_Foster1)\
**Post date:** [February 3, 2022, 9:29pm UTC](https://forum.ansible.com/t/xml-to-datetime/36287/2 "2022-02-03T21:29:09Z")

</div>

Perhaps the XML module is an option:

[https://docs.ansible.com/ansible/latest/collections/community/general/xml\_module.html](https://docs.ansible.com/ansible/latest/collections/community/general/xml_module.html)

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [February 3, 2022, 10:41pm UTC](https://forum.ansible.com/t/xml-to-datetime/36287/3 "2022-02-03T22:41:44Z")

</div>

Where does this xml originate from?
