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
Dorababu Meka
230
8.3k
1.7m
Why i am unable to convert Datetime to the requiredformat
Feb 19 2011 4:58 AM
I am having my object variable declared as DateTime.
My date string is as follows
string strDate = "9999-12-31 00:00:00";
I use the below conversion
string FormatDateString(string strDate)
{
DateTime dt = DateTime.ParseExact(strDate, "yyyy-MM-ddTHH:mm:ss", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None);
return dt.ToString("yyy-MM-dd");
}
But while assigning to my object which was declared as DateTime i am getting an error if i convert it to datetime and assign i am missing the format i required so can any one tell how can i pass the one i needed to my object
I would like to pass Date to the object as "yyyy-MM-dd"
Reply
Answers (
6
)
validation
FAQ form