There is a column in my excel which contains DOB like Feb 03 2022, 2022/03/02 ,2022 03 Feb, Feb/03/2022

There was a column in my excel sheet which contains DOB data like
Feb 03 2022
2022/03/02
2022 03 Feb
Feb/03/2022

I have to pass the month, Day and Year separately into my application, below is my Application text boxex to pass the DOB input

If My DOB data contains 03/11/2022(MMM/dd/yyyy) or 03-11-2022(MMM-dd-yyyy) my bot was able to separate Month, day, Year with the below expression
DateTime.ParseExact(DOB,“mmm/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture)
And Passing the DOB successfully into my application.

But when My Excel column contains above mentioned date formats
Feb 03 2022
2022/03/02
2022 03 Feb
Feb/03/2022
the bot was unable to separate them
Can Someone help me on these issue

have a look here:

you will be introduced to handling different formats in one go

Hi @Vamsikrishna_Talam

in addition to @ppr suggestion you can convert the entire date column in to a suitable format and append at the end of the dt and use this column for further processing. This step is sort of a data massaging

hope this is helpful

image

Hi @Vamsikrishna_Talam

How about this expression?

Output Format → dd.MM.yyyy

DateTime.ParseExact("03 Feb 2022",{"dd MMM yyyy","MMM/dd/yyyy","yyyy dd MMM","yyyy/dd/MM"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd.MM.yyyy")

To get the Date (dd)

DateTime.ParseExact("03.02.2022","dd.MM.yyyy",System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd")

To get the Month (MM)

DateTime.ParseExact("03.02.2022","dd.MM.yyyy",System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MM")

To get the Year (yyyy)

DateTime.ParseExact("03.02.2022","dd.MM.yyyy",System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("yyyy")

image

Regards
Gokul

1 Like