Error while converting String variable to Date format

I am getting error While converting the string variable to date format for following methods, please suggest me where i made mistake.

  1. Convert.ToDateTime Method
    Eg:- Convert.ToDateTime(DobStr.ToString)
  2. DateTime.Parse method
    Eg:- DateTime.Parse(DobStr.ToString)

I am able to achieve by using the following expression



Try like this:

Assign strDate = Datetime.ParseExact(Strinput.ToString, “MM-dd-yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)


Where MM-dd-yyyy is the input format
Where dd/MM/yyyy is the output format


So use that one.

If a variable’s datatype is string, you don’t need to put .ToString on the end of it

Can you share with us the DobStr Value? e.g. immediate panel screenshot
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum


this string is parseable with the mentioned option


ensure that dd/MM/yyyy format pattern is always matching the format pattern of your string

Convert.toDateTime, DateTime.Parse, CDate will not handle the dd/MM/yyyy format

So, is your topic solved or what is your further open question on this?


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