DateTime.TryParse
This I believe is faster and it means you dont have to use ugly try/catches 🙂
e.g
DateTime temp;
if(DateTime.TryParse(startDateTextBox.Text, out temp))
{
// Yay :)
}
else
{
// Aww.. :(
}
More Related Contents:
- Converting a String to DateTime
- How can I convert a Unix timestamp to DateTime and vice versa?
- Parse DateTime with time zone of form PST/CEST/UTC/etc
- How to remove time portion of date in C# in DateTime object only?
- How can I round up the time to the nearest X minutes?
- DateTime “null” value
- WinForm UI Validation
- How do I get the last day of a month?
- Measuring code execution time
- Display only date and no time
- In C# check that filename is *possibly* valid (not that it exists) [duplicate]
- C# Validating input for textbox on winforms
- How to format DateTime to 24 hours time?
- Parse C# string to DateTime
- How do you get the current time of day?
- DateTime’s representation in milliseconds?
- Format date in C#
- DateTime.AddDays() not working as expected
- insert datetime value in sql database with c#
- Convert String to Date in .NET if my incoming date format is in YYYYMMDD
- DateTime conversion from string C#
- DateTime “null” / uninitialized value?
- ASP.Net Core MVC – Client-side validation for custom attribute
- How to check for a valid Base64 encoded string
- Convert Date from Persian to Gregorian
- Unix time conversions in C# [duplicate]
- Add hours or minutes to the current time
- Is the DataTypeAttribute validation working in MVC2?
- Datetime format Issue: String was not recognized as a valid DateTime
- MVC Form Validation on Multiple Fields