Forum Discussion

rad's avatar
rad
Occasional Contributor
9 years ago
Solved

Validating a DateTime from a JSON response to Today's date

I have a testcase using a REST-JSON request. When ever I do a POST , it returns the dateCreated . Since this changes everytime I do a POST ,how do I validate this? Also the response is in JSOn format. The response is 

"DateCreated":"2015-07-20T09:56:35.263"

 

Any help would be appreciated!

  • You may use date format using SimpleDateFormat. And create a date using the same date format before the request is sent. And compare the resulting date which must always be greater than the request date.

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    You may use date format using SimpleDateFormat. And create a date using the same date format before the request is sent. And compare the resulting date which must always be greater than the request date.
    • rad's avatar
      rad
      Occasional Contributor

      Thanks it worked!