I have a project that contain 3 string variables.
DateFormatStr
is the format string I need to use to output dates.DateFormatFrom
is the start date a request will apply fromFilloutDateTo
is the end date the request will apply to.
The problem is that I don't want to manually specify the dates. As you can see in my example below (a working example), I need to specify the dates, but is there a way to make it that the from date has time 00:00:00 and the end date has time 23:59:59?
string DateFormatStr = "MM/dd/yy hh:mm:ss tt";
string DateFormatFrom = "12/04/14 00:00:00";
string FilloutDateTo = "12/04/14 23:59:59";
So I would like to the system time to recognize the from date and the start date respecting the formatStr
variable.
Thanks
If I understand correctly, you can use
DateTime.Today
property like;and use
DateTime.ToString()
to format them like;Results will be;
You used
hh
format specifier but it is for 12-hour clock. UseHH
format specifier instead which is for 24-hour clock. And since your result strings doesn't have any AM/PM designator, you don't need to usett
format specifier.