I've got FROM and TO date textboxes that each have a nice calendar control. The user can select the from and to dates to create a date range.
The values from the user come in as strings (e.g. "03/29/2012", "03/30/2012") and I convert them to DateTime with this code:
DateTime from = Convert.ToDateTime(dateFrom);
DateTime to = Convert.ToDateTime(dateTo);
The values of from and to become this:
"02/29/2012 12:00:00 AM"
"02/30/2012 12:00:00 AM"
The problem is that the last date above (the to date) should include all hours of this day (example: if the user selection 2/29/2012 and 2/30/2012, then the DateTimes I need are "02/29/2012 12:00:00 AM" and "02/30/2012 11:59:59 PM", so that all of 2/30/2012 are included.
What is the best, and most effective, way to format the last date (the to date) so that it includes the entire day?