locked
Error in live server RRS feed

  • Question

  • User1665719730 posted

    String was not recognized as a valid DateTime in live server

    txt_AssessmentEndDate.Text = Convert.ToDateTime(dt.Rows[0]["AssessmentEndDate"]).ToString("MM/dd/yyyy") ; server before upload in live

    DateTime AssessmentEndDate = DateTime.ParseExact(txt_AssessmentEndDate.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture); server after upload in live

    Wednesday, September 26, 2018 5:27 AM

All replies

  • User283571144 posted

    Hi nagaraji,

    As far as I know, the ToString method uses current culture information about DateTime format.

    If you use the ParseExact to convert the string back to the datatime, it may not recognized as a valid DateTime format.

    I suggest you could try below codes:

           txt_AssessmentEndDate.Text = Convert.ToDateTime(DateTime.Now).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);
     DateTime AssessmentEndDate = DateTime.ParseExact(txt_AssessmentEndDate.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture);

    Best Regards,

    Brando

    Wednesday, September 26, 2018 9:30 AM
  • User1120430333 posted

    String was not recognized as a valid DateTime in live server

    You need to explain more than what you have explained here, like show some possible code that may be the issue.

    Wednesday, September 26, 2018 10:40 AM