Ramco Ramco

Ramco Ramco

  • 443
  • 3.4k
  • 521.3k

String was not recognized as a valid DateTime

Apr 20 2023 4:41 AM

Hi

  I am geeting above error on below line. In ltrlSessionDate.Text value is "21-06-2023"

<asp:Literal ID="ltrlSessionDate" runat="server" Text='<%# Eval("SessionDate","{0: dd-MM-yyyy}") %>'></asp:Literal></td>

DateTime sessionDate = DateTime.ParseExact(ltrlSessionDate.Text, "dd-MM-yyyy", CultureInfo.InvariantCulture);

Thanks


Answers (7)