Skip to main content
Solved

Java regex date formats and how to write dq rules for date patterns yyyy-mm-dd hh:mi:ss.ms

  • February 13, 2024
  • 1 reply
  • 123 views

Forum|alt.badge.img

Hi folks, I have a date format that I need to validate using a DG rule in Ataccama ONE. I don’t need to do anything with it, just validate that the format is as expected. Any ideas on how I can achieve this please?

Many thanks

DC

 

Best answer by Samuel Muvdi

Hello @Delbert71!

I recommend trying to do something like this with an advanced expression. It will turn your date to a string and see if its able to in that format, and if it doesn't return null, then its correct, it is of that type:

toString(date, 'yyyy-MM-dd hh:mm:ss') is not null

1 reply

Forum|alt.badge.img+2
  • Ataccamer
  • Answer
  • February 13, 2024

Hello @Delbert71!

I recommend trying to do something like this with an advanced expression. It will turn your date to a string and see if its able to in that format, and if it doesn't return null, then its correct, it is of that type:

toString(date, 'yyyy-MM-dd hh:mm:ss') is not null