I am trying to convert string format date into a datetime object and it is giving an error.
Before the explanation, I am mentioning the following dependencies:
.NET framework (v4.6.1 as per UiPath Studio latest version).
.NET framework (v4.6.1 as per Visual Studio).
C# as the language for custom operations.
I am able to run this piece of code in Visual Studio and getting the desired output in Visual Studio. But, the same is failing in UiPath even though the .NET framework version is same.
I am using the following code :
{
var d = Convert.ToDateTime("29.09.1999");
Console.WriteLine(d.ToLongDateString());
}
As you can see from the screenshots all dependencies are same.
If the framework and code is same, why is it failing in UiPath ?
I cannot figure out why is it happening.
If any clues please let me know.
I know about the ParseExact method. But my concern is why the Convert class not able to do so here. I mean the convert class in UiPath and Visual Studio are same right ? Then what’s making the code to crash in UiPath ?
The screenshots I have posted are from the same device. The UiPath screenshot attached has clearly mentioned the way I am trying to parse. If you see at the bottom right, the .NET version is 4.6.1 and the time format is also the same. Coming to the other two screenshots of visual studio, there also it is mentioned the version of .NET used for executing the code. The syntax and .NET versions are clearly mentioned if you take a closer look and I am very much sure that in Visual Studio