Hello everyone.
I have a data column from a table in image attached. Those are the dates of some events, some of them from 2022 and the others from 2023. My problem is the fact that I can not convert those dates from string to DateTime (dates from 2023, to be more precise) and therefore I can not perform an sorting table activity based on values from this column. Table Extraction returns blank cells for the 2023 and all the syntaxes used in assign activities returns an error like this “String was not recognized as a valid DateTime because the day of week was incorrect”. How can I solve this problem?
Thanks in advance.
@ionseptelici95
Welcome to the forum
For a next more deep analysis for the invalid string / date have a look here:
[FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime
Parsing Issues - News / Tutorials - UiPath Community Forum
Also let us know which date conversion option was used (CDate, ParseExact…)
I used both CDate and ParseExact, but the same error is thrown.
ok, so we would recommend to follow the linked firstAid sheet and doing the next analysis steps as described there
When converting dates like that you have to parse exact.
Try this:
DateTime.ParseExact("Fri, Sep 23, 8:30 AM","ddd, MMM yy, h:mm tt",system.Globalization.CultureInfo.InvariantCulture)```
in the write line you should have the ouput
myDate.ToShortDateString=09/01/2023
or whatever you want to format it