Friday 1 April 2016

Convert DateTime in particular format in Asp.Net C#

If you have date 5 March,1989 as 03/05/1989 in MM/dd/yyyy format and you want to convert it to
dd/MM/yyyy i.e. 05/03/1989 , then use below C# code for that :


DateTime dtValidity = DateTime.ParseExact(strDate, "M/d/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture);

return dtValidity.ToString("d/M/yyyy");


No comments:

Post a Comment