VS Magicdate string with escape char is not working in DevTest 10.3 or newer
search cancel

VS Magicdate string with escape char is not working in DevTest 10.3 or newer

book

Article ID: 106332

calendar_today

Updated On:

Products

CA Application Test CA Continuous Application Insight (PathFinder) Service Virtualization

Issue/Introduction

The below Magic date string is not working in DevTest 10.3 and newer versions but same is working fine in previous versions 
{{=doDateDeltaFromCurrent("yyyy-MM-dd'T'HH:mm:ss.sss'Z'","0H");/*2017-06-05T11:47:58.801Z*/}}

Environment

All supported DevTest versions

Cause

In the previous versions of DevTest it was parsed differently.  The change was made to fix issues relating to timezone and differences between using z and Z. 
Java's SimpleDateFormat parser will not parse with the sss  for milliseconds as in  yyyy-MM-dd'T'HH:mm:ss.sss'Z' .

The parser wants minutes.seconds.milliseconds

mm -> minutes
ss -> seconds
SSS -> milliseconds.

Resolution

Change the date pattern: yyyy-MM-dd'T'HH:mm:ss.sss'Z'  to   yyyy-MM-dd'T'HH:mm:ss.SSS'Z

In the VSI ,  changed magic dates from :

{{=doDateDeltaFromCurrent("yyyy-MM-dd'T'HH:mm:ss.sss'Z'","0H");/*2017-06-05T11:47:58.801Z*/}}

To

{{=doDateDeltaFromCurrent("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","0H");/*2017-06-05T11:47:58.801Z*/}}

Additional Information

https://docs.oracle.com/javase/7/docs/api/index.html?java/lang/String.html