Strong parsing of a string to Date in MM/dd/yyyy format

Hi guys,

I have a excel sheet having date in dd/MM/yyyy (01/04/2022) and MM/dd/yyyy (04/01/2022) both format.
I want to strong parse these to MM/dd/yyyy whether it is already in MM/dd/yyyy format or any other format.

Hi @Aakash_Singh_Rawat

Try using format cells activity.
image

HI @Aakash_Singh_Rawat

Checkout this expression

DateTime.ParseExact("Your date variable",{"dd/MM/yyyy","MM/dd/yyyy","Any other formats"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MM/dd/yyyy")

Regards
Sudharsan

@Aakash_Singh_Rawat

DateTime.ParseExact(CurrentRow("DateColumn NAme").Tostring,{"dd/MM/yyyy","MM/dd/yyyy","Any other formats"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MM/dd/yyyy")

You can check and add any other formats inside those {“Other format 1”,“Other format 2”}

Regards
Sudharsan

1 Like

HI @Aakash_Singh_Rawat

You can try with strong Date Parsing

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

Output

image

Regards
Gokul

1 Like

Hello @Aakash_Singh_Rawat
You can use format cell activity in modern activity


If you are a classic user, follow this

  1. Click Filter in activities,
  2. Enable the Show modern, you can see the modern activities.
    image

Check out this tutorial @Aakash_Singh_Rawat

Hello @Aakash_Singh_Rawat

You need to loop through the excel and then use the Format cellss activity. You can set the required format in the format cells activity.

Another approach is using the FoRMAT Range activity.

Thanks

Thank you @GT_Ropa,
It worked.

1 Like

Thank you @Gokul_Jayakumar. It worked.

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