I have data table with columns name,date.
now i'm giving the datatypes for column name =string, for date =datetime.
after that i'm adding the datarow. the date value is having 12-25-2109
after adding to data table im getting as 12-25-09 07:00:57:.850 .
but i want to get the the values as 12-25-2019 07:00:57:.850 .because the data type of the column is datetime.how can i get the required format.pla help me.
DataTable dtCloned = sourceDataSet.Tables[0].Clone();
for (int i = 0; i < dtCloned.Columns.Count; i++)
{
if (dtCloned.Columns[i].ColumnName == "ExpirationDate")
dtCloned.Columns[i].DataType = typeof(DateTime);
else if (dtCloned.Columns[i].ColumnName == "Amount")
dtCloned.Columns[i].DataType = typeof(Decimal);
else
dtCloned.Columns[i].DataType = typeof(String);
}


Ramesh PalanivelRank #372 · 6.8K reputationPosted Sep 12, 2017, 3:33 AM EDT
SreeRam KondagorlaRank #8,160 · 227 reputationPosted Sep 12, 2017, 5:22 AM EDT
Ramesh PalanivelRank #372 · 6.8K reputationPosted Sep 12, 2017, 5:26 AM EDT