I have a variable that receives DATETIME type ,And sometimes comes from DB NULL variable So I have this code .
DateTime? d;
DateTime dtq;
don.Date_appeal_donor= d = DateTime.TryParse(dr["Date_"].ToString(), out dtq) ? dtq : (DateTime?)null;
And I can not change the format to "dd / MM / yyyy" Does anyone have a solution?
You're right, now I realized that only when it comes to DATAGRIDVIEW It changes the display This is in wpf. So I fill the data grid
dataGrid1.ItemsSource= DAL.LoadCollectionData();
And here I am stuck
dr["Date_"]actually already is aDateTimevariable, why do you convert it then first to aStringand then try-parse it back to aDateTime?