TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kalpana Jaiswal
NA
6
586
How to change dd/mm/yyyy date formate of excel to dd-mm-yyyy
Mar 17 2020 4:43 AM
Date in my data table is in 1-3-2020 this format . I am saving this date in excel file by using following code
for (int j = 0; j < CopyDataTable.Rows.Count; j++)
{
for (int k = 0; k < CopyDataTable.Columns.Count; k++)
{
if (k == 7 || k == 10)
{
if (CopyDataTable.Rows[j].ItemArray[k].ToString().Contains("-"))
{
xlWorkSheet.Range[xlWorkSheet.Cells[j + 2, k + 1], xlWorkSheet.Cells[j + 2, k + 1]].NumberFormat
= "dd-mm-yyyy";
}
try
{
xlWorkSheet.Cells[j + 2, k + 1] = CopyDataTable.Rows[j].ItemArray[k].ToString();
}
catch (Exception ex)
{ }
}
xlWorkSheet.Cells[j + 2, k + 1] = CopyDataTable.Rows[j].ItemArray[k].ToString();
}
}
but it is displaying as 03-01-2020 in excel and i want to display as 01-03-2020 . Please provide solution for it.
Reply
Answers (
1
)
RichText LoadFile/SaveFile function for normal text
Need help with listbox