# Date Format response No match?

**URL:** <https://community.postman.com/t/date-format-response-no-match/52749>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [October 3, 2023, 12:35pm UTC](https://community.postman.com/t/date-format-response-no-match/52749 "2023-10-03T12:35:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paciccia](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@Paciccia](https://community.postman.com/u/Paciccia)\
**Post date:** [October 3, 2023, 12:35pm UTC](https://community.postman.com/t/date-format-response-no-match/52749/1 "2023-10-03T12:35:57Z")

</div>

Hi,  
I’m testing the format of this value “date” but unfortunately I received this.  
Do you have any suggestions?  
These are the elements:

**Request POST Body**

{  
“key”: “value”,  
“date”: “2017-07-21T17:32:28Z”,  
“key”: “value”,   
“key”: “value”,  
“key”: “value”,  
“key”: “value”  
}

**Test GET**

const jsonData = pm.response.json();  
pm.test(“date is in the correct format”, function () {  
pm.expect(jsonData.date).to.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/);  
});

**GET response**

“date is in the correct format | AssertionError: expected ‘2017-07-21 17:32:28+00:00’ to match /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/”

Thanks!

 ![Screenshot](https://us1.discourse-cdn.com/getpostman/original/3X/0/a/0aea21d33ef181c0e5b51e7a0a11046591bfaa57.png)

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [October 3, 2023, 1:50pm UTC](https://community.postman.com/t/date-format-response-no-match/52749/2 "2023-10-03T13:50:24Z")

</div>

The value in your request is an ISO date with UTC (which is what the Z on the end means).

For some reason, the assertion is changing it to relative time. (+00:00) which then fails your regex.

Can you double check the response and ensure the API hasn’t changed the date format.

Also have a look here for some other regex’s that you might want to consider.

[regex to verify UTC date time format - Stack Overflow](https://stackoverflow.com/questions/25568134/regex-to-verify-utc-date-time-format)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [November 2, 2023, 1:50pm UTC](https://community.postman.com/t/date-format-response-no-match/52749/3 "2023-11-02T13:50:56Z")

</div>

Closed on November 2, 2023, 1:50pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
