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
SreeRam Kondagorla
NA
234
56.2k
Set Data Type MM/DD/YYYY for Data table Column
Sep 12 2017 7:22 AM
I have data table with columns name,date.
now i'm giving the datatypes for column name =string, for date =datetime.
after that i'm adding the datarow. the date value is having 12-25-2109
after adding to data table im getting as 12-25-09 07:00:57:.850 .
but i want to get the the values as 12-25-2019 07:00:57:.850 .because the data type of the column is datetime.how can i get the required format.pla help me.
DataTable dtCloned = sourceDataSet.Tables[0].Clone();
for (int i = 0; i < dtCloned.Columns.Count; i++)
{
if (dtCloned.Columns[i].ColumnName == "ExpirationDate")
dtCloned.Columns[i].DataType = typeof(DateTime);
else if (dtCloned.Columns[i].ColumnName == "Amount")
dtCloned.Columns[i].DataType = typeof(Decimal);
else
dtCloned.Columns[i].DataType = typeof(String);
}
Reply
Answers (
3
)
See Details by Employee Code.
What is the objective of code benchmarking and what it does