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 CPosted Sep 2, 2021, 12:31 PM
Ranjith BalanPosted Sep 2, 2021, 12:42 PM
Ranjith BalanPosted Sep 2, 2021, 11:23 AM
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)
Ganesan CPosted Sep 2, 2021, 11:13 AM
Ranjith BalanPosted Sep 2, 2021, 11:06 AM
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 CPosted Sep 2, 2021, 11:03 AM
Ranjith BalanPosted Sep 2, 2021, 11:01 AM
Ranjith BalanPosted Sep 2, 2021, 10:58 AM
Ganesan CPosted Sep 2, 2021, 10:53 AM
Ranjith BalanPosted Sep 2, 2021, 10:44 AM
Ganesan CPosted Sep 2, 2021, 10:38 AM
Ranjith BalanPosted Sep 2, 2021, 9:46 AM
Ganesan CPosted Sep 2, 2021, 9:31 AM