Convert day month year string to date time(Thursday, November 12, 2020 10:32:47 AM)

Hi there,

i have a scenario where in a data table particular column contains date time value ( For Ex: Thursday, November 12, 2020 10:32:47 AM), I need to find the max values in that column Or else in need to convert to dd/mm/yyyy format. Could you please help on this.

@Palaniyappan

Thanks,
Rangarajan

1 Like

Hi @Rangarajan

Hope these steps would help you resolve this
–use a for each row activity and pass the datatable as input
–inside the loop use a assign activity like this
Str_input = Split(row(“columnname”)“,”)(1).ToString.Trim+" “+split(row(“columnname”),”,")(2).ToString.Trim.Substring(0,4).ToString

–use another assign activity and mention like this
row(“columnname”) = Datetime.ParseExact(Str_input,“MMMM dd yyyy”,system.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

here columnname is the name of the column you are referring to change
and make sure that this format works for the ex date mentioned along the query

Kindly try this and let know for any queries or clarification

Here you go with a sample workflow
Rangarajan.zip (2.2 KB)

Cheers

1 Like

@Rangarajan

used format pattern:
dddd, MMMM dd, yyyy HH:mm:ss tt

1 Like

Thank you so much @Palaniyappan, i tried your method but unfortunately i cannot open main module due to version conflict , Also i tried in below comment method it worked i made little tweaks in that,

i got the result
DateTime.ParseExact(“Thursday, November 12, 2020 10:32:47 AM”, “dddd, MMMM dd, yyyy HH:mm:ss tt”, new System.Globalization.CultureInfo(“en-US”)).ToString(“MM/dd/yyyy”)

Thanks for the output you have showed i tried with above code but i got some issues then i tried in below format

DateTime.ParseExact(“Thursday, November 12, 2020 10:32:47 AM”, “dddd, MMMM dd, yyyy HH:mm:ss tt”, new System.Globalization.CultureInfo(“en-US”)).ToString(“MM/dd/yyyy”)

now its working fine .

Thank you so much

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