How to Extract Multiple Date Formats

Hi guys,

I’ve date Formats in pdf as December 16,2019
and in other 16-December-2019, how do i extract all of them at once

Is these are the two formats or is there any other formats coming up in pdf
Cheers @Pradeep_Shiv

only these two

So let’s take we get this with any activity like get text or screen scrapping and store it in a string variable named str_input
—now use a IF condition like this
If true it will go to then part where use like this to get the DateTime variable with a assign activity
datetime_var = DateTime.ParseExact(str_input,”dd-MMMM-yyyy”,System.Globalization.Cultureinfo.InvariantCulture)

Where datetime_var is a DateTime variable

Or if that fails it goes to else part
Where use this expression
datetime_var = DateTime.ParseExact(str_input,”MMMM dd, yyyy”,System.Globalization.Cultureinfo.InvariantCulture)

Then we can use this DateTime variable we want either as DateTime or as a string with ToString atlast

Cheers @Pradeep_Shiv

i’m using regex to get the dates of this format December 16,2019 im not using any screen scrapping or get text

1 Like

That is fine once after getting this with Regex if we want to convert that to a DateTime variable then we can use these steps

Cheers @Pradeep_Shiv

DateTimeParseMultipleFormats.xaml (7.5 KB)

Please check this…! @Pradeep_Shiv