Service Virtualization

Expand all | Collapse all

How to amend the system time in reponse

Jump to Best Answer
  • 1.  How to amend the system time in reponse

    Posted 05-28-2018 08:06 AM

    Hi All ,

    Hope you all doing well . We need to create a JSON stub and send the response dynamically by fetching the system time and amend in the response tag .we tried giving System.currentTimeMillis in match script but that gives the time in milliseconds whereas we need the system time in proper format(Hr:Min:sec) and the same value need to be sent in the response whenever we received the hit

     

    Could you please advise the possibility of doing it



  • 2.  Re: How to amend the system time in reponse
    Best Answer

    Posted 05-28-2018 09:58 AM

    Have you tried adding a Magic Date in the VSI Response JSON payload having only a time format? Refer to:

    Magic Dates - DevTest Solutions - 10.1 - CA Technologies Documentation

    Magic Dates - DevTest Solutions - 10.3 - CA Technologies Documentation  

    Look for the commentary on: {{=doDateDeltaFromCurrent("yyyy-MM-dd","0D");/2008-12-17}}  

     

    To return time only, send the Magic Date processor a valid simple date format with add zero seconds instruction.  For example: "JsonTagTimeHHmmss": "{{=doDateDeltaFromCurrent("HH:mm:ss", "0S");/*12:14:31*/}}" or "hh:mm:ss" depending on which format you want

    If this is not working, please raise a support ticket.