Aniket Narvankar

Aniket Narvankar

  • 559
  • 2.1k
  • 605.4k

String was not recognized as a valid DateTime

Dec 29 2023 7:05 AM

I am getting error on this code
var newDate = DateTime.ParseExact(
                                lineArr[0],
                                "dd-MM-yyyy",
                                System.Globalization.CultureInfo.InvariantCulture);

lineArr[0] has date as 29-12-2023
when I run the job from server get this error. when i run it from local no error is there.
this get formated to 12/29/2023


Answers (6)