What is the proper way to use the DateTime.TryParse() method to convert the string to a DateTime object, and then use the DateTime.ToShortDateString() to reformat the data into the the string?
Output:
5/26/2016 12:00:00 AM
Desired:
5/26/2016
To get current date and time:
DateTime CurrentDateTime = DateTime.Now;
To Convert today's DateTime to short date:
string CurrentDate=CurrentDateTime.ToShortDateString();
To Convert today's DateTime to short time:
string CurrentTime= CurrentDateTime.ToShortTimeString()
Resources:
How to convert datetime to short date time
DateTime.ToShortDateString Method ()