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
Siva Ramamoorthy
NA
14
771
DateTime.TryParseExact is failing with 13+ Hrs
Feb 16 2018 5:22 AM
string expirtyDate0 = "12/31/2200 23:59"; - Failed
string expirtyDate1 = "2/31/2200 23:59"; - Failed
string expirtyDate2 = "2/1/2200 23:59"; - Failed
string expirtyDate3 = "1/3/2200 3:59"; - Success
string expirtyDate4 = "1/3/2200 3:9"; - Success
string[] dtFormat = { "MM/dd/yyyy hh:mm", "M/d/yyyy hh:mm", "M/dd/yyyy hh:mm", "MM/d/yyyy hh:mm","MM/dd/yyyy h:mm","MM/dd/yyyy hh:m","MM/dd/yyyy h:m","M/d/yyyy h:mm", "M/d/yyyy hh:m", "M/d/yyyy h:m","M/dd/yyyy h:mm", "M/dd/yyyy hh:m", "M/dd/yyyy h:m","MM/d/yyyy hh:mm", "MM/d/yyyy hh:mm", "MM/d/yyyy hh:mm" };
DateTime expiryDateValue;
if (DateTime.TryParseExact(expirtyDate0, dtFormat, new CultureInfo("en-US"), DateTimeStyles.None, out expiryDateValue))
{
Console.WriteLine("successed");
}
else
{
Console.WriteLine("failed");
}
I observed that if we give hh after 12 it's failing. Do we need to any other format
Reply
Answers (
3
)
How to fire scheduler using C# based on Event table in DB?
LINQ - preferred way