Specifying Times for Today's Date

I have two variables..."aStartDate" and "anEndDate"

Every time my application runs I want the following to happen:

I want "aStartDate" to be populated with today's date (whatever date that is), with a time of midnight and then I want "anEndDate" to be populated with the same date, but with a time of 11:59 p.m.

I can't seem to figure out how to use the DateTime functions to do that.

Thank you in advance.

Sean



Answer this question

Specifying Times for Today's Date

  • tattoo

    dateStart = DateTime.Today;
    dateEnd = DateTime.Today.AddDays(1).AddMinute(-1);

  • Specifying Times for Today's Date