I am trying to convert a string into desired format. e.g. If string/datetime is 14-02-2022 06:32:00 then output should be Feb22. For doing the same, I have tried the following methods:
Datetime.ParseExact(dateCol.ToString,“dd-MM-yyyy hh:mm:ss”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMY”)
Also, I have tried multiple date formats, just to check but I am finding the below error again and again.
Error: Update Month Column: String was not recognized as a valid DateTime.
Request the readers to let me know if there is any other method for doing the same. or how to debug the same.
Any help is appreciated.
Datetime.ParseExact(“14-02-2022 13:32:00”,“dd-MM-yyyy HH:mm:ss”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMY”)
as 13:32:00 occurs we would parse with HH for the hours
this will help:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
And also have a look here:
adding to Peter’s suggestions:
HH -means 24 hours format
hh -means 12 hours format
when you pass 13:08 to “hh:mm” it fails as 13 is not valid in 12 hours formatting
So using HH will work
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.