I am creatin a datatable in C#,(sharepoint 2010). I want to add a column of datatype date having format “dd/mm/yyyy”
Can anyone tell me how to define a datatype for this column?
I tried this:
//SharePoint2010
table.Columns.Add("Start Date", typeof(DateTime));
To display in dd/MM/yyyy
DateTime sdt = DateTime.Parse(req["Start_x0020_Date"].ToString());
row["Start Date"] = sdt.ToString("dd/MM/yyyy");
But i am getting the output as dd/MM/yyyy HH:MM:SS
Please help i want the output as dd/MMyyyy
Add
DateTimecolumn to theDataTableand later you may format it to “dd/MM/yyyy” format.EDIT:
No need to use DateTime column type to store string. Use string column type.