How to fix the dates format when output contains some other numbers in it?

Lets suppose correct data formats are 01/01/2020 or 1/1/2020 or 01/1/2020 or 1/01/2020.

So whats happening, i am receiving dates in this format sometimes 01701/2020 so here slash (/) changes into 7, so i want to fix this issue. So that even if slash becomes something else, it can skip 7 and gives me the exact date.

Please assume second slash can also change like first.

Interesting. Is there always supposed to be 3 slashes? Is the 7 sometimes found as the second slash? Is the 7 always associated with a date that has January in it?

I can see an issue when it is July or the 7th of the month so if some more assumptions can be made-then easier to check for error.

You could count the slashes and when less than 3, then look for the error.

Is the data coming from a scrape or OCR activity? If so have you considered scraping the data and checking for the error and if error found, try using another scrape using a different scale.

Yes actually data is coming from OCR, i already check the scale part. And its not about 7, slash can be anything -sometimes it comes as 1- and also its not about july month.

Slashes are always there, only thing we have to check we have something in place of slash, bot can remove that.

Dates Format: mm/dd/yyyy, m/d/yyyy, m/dd/yyyy, mm/d/yyyy. Can you provide some logic for that, that can be great help.

Yikes. Is there another way to validate the date data other than scraping? Like a data export some how?

Other than that here is the logic I thought about:
when date has three slashes you should have a valid date
when date has length 10 you should have a valid date just ignore the chars where the slashes should be.
when date has length 8 you should have a valid date just ignore the chars where the slashes should be
when date has 9 digits and first digit is 0 then you know locations of slashes
when date has 9 digits and first digit is not zero this is the tricky part as issues with 1/11 and 11/1.

Is this an attended robot? perhaps you could insert step to ask for user input when the last condition is met to manually verify the dates.

1 Like

Thankyou matt for the inputs.

No its not attended robot, and also scraping is the only method.
I am also thinking about the same logic, Let me try this.

Also if you will get to know something else. let me know. Thankyou for your help.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.