How to deal with different date formats returning from Abbyy

Hi,
I am dealing with date returned from Abbyy manual verification station so :
Case 1:
Client enter the format like 5/3/2019 10:13:43 AM format as (M/d/yyyy) and sometimes they enter like 05/03/2019 10:13:43 AM format as (MM/dd/yyyy).
Case 2:
Client enter the format like 5/3/2019 10:13:43 AM format as (d/M/yyyy) and sometimes they enter like 05/03/2019 10:13:43 AM format as (dd/MM/yyyy).
I am getting this “String was not recognized as a valid DateTime” error in some cases.

So i want to deal with all this date formats that it should work with format like M/d/yyyy or MM/dd/yyyy or d/M/yyyy or dd/MM/yyyy.
I am also attaching my workflow.
Please help me on this
Date_Test.zip (11.2 KB)

1 Like

Aaaaaah Buddy @zeshanm9, this is really an amazing question …really, took some time to get the condition, but came out with a simple solution…here you go
Datetimevalidate.zip (11.5 KB)

try with any format with input as string in the xaml
5/3/2019 10:13:43 AM format as (M/d/yyyy)
05/03/2019 10:13:43 AM format as (MM/dd/yyyy)
5/3/2019 10:13:43 AM format as (d/M/yyyy)
05/03/2019 10:13:43 AM format as (dd/MM/yyyy)

This would validate and gives you the datetime format ,here i have used messagebox to display thats why converted to string, if you want you can have that in datetime format assigned to datetime variable as well

Cheers buddy @zeshanm9
Kindly let know if this works with your scenario or not, buddy

Thank you @Palaniyappan i will try this and will let you know
I have one more question how to check if this date is less than one year or not?

1 Like

Same buddy @zeshanm9
Datetime.Parseexact(input_time,“dd-MM-yyyyy”, system.globalization.cultureinfo.invariantculture) <= Datetime.now.Addyears(-1)
Cheers
…did that work buddy… @zeshanm9

Yeah @Palaniyappan Great it’s working with me now as i change according to my conditions.
Please see attached workflow
Cheers
Test.zip (13.2 KB)

yah thats amazing buddy @zeshanm9
If this works and got resolved kindly close this topic with right comment marked as solution that could help others looking for ideas under your topic buddy

Cheers @zeshanm9

Done
Cheers @Palaniyappan

1 Like

Cheers buddy Keep going @zeshanm9

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