Hi, i have to bind mm/dd/yyyy format date in to text format in excel. i used below code.But its still in Custom format how can change this to Text in excel
ie: Any format coming from excel i need to bind mm/dd/yyyy format and i have to change the excel Date coloumn format(any format from excel) to Text.Attached a screen shot
string effdate = xlWorksheet.Cells[i, datecolm].Value.ToString();
var words1 = effdate.Split(' ');
var white1 = words1.FirstOrDefault();
DateTime dt = DateTime.Parse(white1);
xlWorksheet.Cells[i, datecolm] = dt.ToString("MM/dd/yyyy");
xlWorksheet.Cells[i, datecolm].NumberFormat = "MM/DD/YYYY";


Ganesan CRank #369 · 6.8K reputationPosted Sep 2, 2021, 8:31 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Sep 2, 2021, 6:53 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Sep 2, 2021, 5:31 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Sep 2, 2021, 6:38 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Sep 2, 2021, 7:03 AM EDT
Ranjith Balan34 reputationPosted Sep 2, 2021, 7:06 AM EDT
effdate= 01-01-2015 00:00:00
white1 = 01-01-2015
DateTime dt = DateTime.Parse(white1) in this line dt is like 01-01-2015 00:00:00
Ganesan CRank #369 · 6.8K reputationPosted Sep 2, 2021, 7:13 AM EDT
Ranjith Balan34 reputationPosted Sep 2, 2021, 7:23 AM EDT
xlWorksheet.Cells[i, 8].Value.ToString()= 01-01-2015 00:00:00 // in code. 01-01-2015 in sheet
from string effdate = xlWorksheet.Cells[i, 8].Value.ToString(); // getting original excel value-"01-01-2015 00:00:00" in excel sheet its in 01-01-2015 format
whatever date value coming from excel need bind back to mm/dd/yyyy format .But the coloumn format shoud be Text(i need to convert this sheet to pipe delimiated string)
Ranjith Balan34 reputationPosted Sep 2, 2021, 8:42 AM EDT
Ranjith Balan34 reputationPosted Sep 2, 2021, 5:46 AM EDT
Ranjith Balan34 reputationPosted Sep 2, 2021, 6:44 AM EDT
Ranjith Balan34 reputationPosted Sep 2, 2021, 6:58 AM EDT
Ranjith Balan34 reputationPosted Sep 2, 2021, 7:01 AM EDT