I am working on the winforms.
I want to save the date from datetimepicker in (dd/mm/yyyy ) format to the EXCEL sheet. I managed to save date as 10/10/2010 in one of the cells of excel sheet.
But when i m trying to read that value from excel sheet into the string what i get is,
string dateString ="40461";
what i was expecting is ,
string dateString ="10/10/2010";
Is it possible to convert this string (40461)into the format (10/10/2010) and to display as default time in datetimepicker on开发者_如何学运维 form load.
I even tried manually changing format of cell of the excel but didn't work for me. any help regarding this issue ? Thanx in advance.
Try this...
double dateDouble = 40461;
DateTime dt = DateTime.FromOADate(dateDouble);
string dateString = dt.ToString();
精彩评论