If I understood it correctly then it is as simple as:
DateTime startDateTime = DateTime.Today.AddHours(6); //DateTime.Today set to 6:00 AM
DateTime endDateTime = startDateTime.AddDays(1);
DateTime.Today
will give you the current Date with time part set to 00:00:00
, you can add 6
hours to it and that would give you current Date set to 6:00 AM
. To get endDateTime
you can add 1
day to your startDateTime
.
If you want your endDateTime
to be Current Day + 1 and time set to 5:59:59
then you can do:
DateTime endDateTime = startDateTime.AddDays(1).AddTicks(-1); //(most accurate)