User753101303 posted
Hi,
Plus you convert a an object which is likely a DateTime already to a string and then back to DateTime before doing the final conversion.
Something like that :
var dtCheck = new DataTable();
dtCheck.Columns.Add("datefrom",typeof(DateTime));
dtCheck.Rows.Add(DateTime.Today);
string ldatefrom = String.Format("{0:MM/dd/yyyy}", dtCheck.Rows[0]["datefrom"]);
Console.WriteLine(ldatefrom); // Shows 05/14/2019
A common confusion is to not understand that you have how the value is stored (which is the same for everyone) and how it is shown (depending on your country or which tools you are using) as there is no worldwide convention for this.
My personal preference would be to differ that up to UI rendering. It can also help to make an app that could easily support multiple languages...