Date Format Validation
Best Answer
-
When I want to look up a regular expression for date and time I usually copy the one from the XML Schema spec: https://www.w3.org/TR/xmlschema11-2/#nt-dateTimeRep
It isn't the same as the format you are describing but you can base it on that one. You probably want something like this:
([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]) (([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))
1
Answers
-
In SOA test actually
0 -
You could use a regular expression to check if the text matches an expected pattern.
If you are doing the assertion with a Diff tool in Text mode then you can select "Regular Expression" on the Options tab.
If you are doing the assertion with an XML/JSON Assertor tool then you can add a "Regular Expression Assertion".
0 -
I tried Regular expression but there are no options to validate the time and date format. The options available in drop down of Regular Expression are equal to , not equal to , greater than etc,..
0 -
Concerning "the time and date format" there is no single standard date and time format. You need to provide a regular expression any time you want to check if some text matches a particular expected pattern, whether it is some particular date-time pattern or the pattern for something else.
0 -
oh thank you very much I understood now, it worked
1