Hi I have a windows form application. its has a database table with two columns of DATE type. I can insert the dates in the columns easily, in MM/dd/yyyy format. But when it comes to retrieving data from the table, I use the following code.
SqlDataAdapter sda=new SqlDataAdapter(“select * from table”,conn);
DataSet ds=new DataSet(); sda.Fill(ds,”table”);
Now i need to display the content of ds which contains DATE in a label. If I do this:
label1.Text=ds.Tables[0].Rows[0][0].ToString();
It displays complete date with 12:00:00 AM time as well! I want to format this value as MM/dd/yyyy. I am using c#. Please help.
Basically I want to know How can i format a string into DATE format like “MM/dd/yyyy”
Try this :-