Skip to main content

Hi Team,

I have tried to create Accuracy rule for Date datatype to check whether Date is in the standard format. 

Accurate rule should be as follows:

  • Standard date format is ‘MM-DD-YYYY’.
  • If date is entered in any format other than the above mentioned (‘DD-MM-YYYY’ or ‘YYYY-MM-DD’ or ‘YYYY-DD-MM’) then it should be considered as inaccurate.

When I tried using regex expression, I am getting error.

 

Any ideas?

Hi @anagha.k,

I suggest you change type of the input attribute to String. If your data is already stored as Date datatype it means it is already valid date and format is enforced by the source.

Yet if you need to check Date type field, I suggest removing implicit type conversion using variables and rewrite expression using toString function.

matches(@"^(\d{1,2})-(\d{1,2})-(\d{4})$", toString(input_dt, "dd-MM-yyyy"))

 

 


Reply