Forum Discussion

nolandsmith's avatar
New Contributor
2 years ago

Regex with Dates

Is it possible to change the date format with RegEx?


The standard format with dates is: YYYY-MM-DD


However, I need all dates in MM/DD/YYY


Is it possible to place YYYY on the end, and replace the "-" with "/" ?


Please let me know if anyone has been able to solve this before!

3 Replies

  • You could use a property with type: string and a pattern: <regex> tag to enforce your desired date format. Pattern can be crafted to make sure year starts with a 1 or 2, month is 01 to 12 and days are correct for the designated month. Don’t forget leap years !


    lots of good examples here:


    • nolandsmith's avatar
      New Contributor

      Thanks for much for the quick response!

      I might be misunderstanding the point of the Pattern property. No matter what I put in the regex expression, the output always come back in the same format "YYY-MM-DD"


      Can we use Regex to change the actual output value format? (apologies I'm new to Regex)



      • mhiggins's avatar
        Ah, I wasn’t clear. Name the property as you see fit. But make it type: string with just a pattern tag, no format tag. Add default, example tags optionally.

        Micheál Higgins
        Senior Solutions Architect
        SmartBear Software

        Sent from my iPad

        We hope you found this email of interest; however, click here if you wish to unsubscribe<> or manage your email preferences. Privacy Policy.<>


        The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.