Wednesday, November 30, 2022

String was not recognized as a valid DateTime ASP.NET C#

 this.Text="22/11/2009";


DateTime date = DateTime.ParseExact(this.Text, "dd/MM/yyyy", null);


reference:- https://stackoverflow.com/questions/2193012/string-was-not-recognized-as-a-valid-datetime-format-dd-mm-yyyy



or


PIPD = DateTime.Now.ToShortDateString();

DateTime PIP = DateTime.ParseExact(PIPD, "dd/MM/yyyy", null);

No comments:

Post a Comment