Parse datetime

I have a string “27 Nov” which i need to convert into date time format “MM/dd/yyyy” but i am getting error as “string not regonized as valid datetime”

DateTime.ParseExact(strVal,“dd MMM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)

prototyping within the immediate panel was working:

can you debug and inspect the value of strVal?

Actually i am getting date from get text and storing in datatable and using dt.rows(0)(“StorageDate”).tostring.trim in datetime.parseexact

@harshit.gupta

Check below link for your reference

Reference

Hope this may help you

Thanks

just check dt.rows(0)(“StorageDate”).tostring within immediate panel and if possible please share with us the result

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

1 Like

Hi,

There might be different type whitespace in the string. So, for now, can you try the following expression?

DateTime.ParseExact(System.Text.RegularExpressions.Regex.Replace(dt.rows(0)("StorageDate").ToString,"\s",""),"dMMM",System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")

Regards,

Thankyou, this actually worked for me.

1 Like

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