title: How to check if time is next day
body: <p>I have a windows application where user enters Start Time and End Time, How to check if End time is next day time.</p>
  
  <pre><code>example: start time           end time
            1:00:00 AM          5:00:00 AM
            5:00:00 AM          10:00:00 AM
            10:00:00 AM          5:00:00 PM
            5:00:00 PM          10:00:00 PM
            10:00:00 PM          1:00:00 AM --(next day)
            1:00:00 AM          5:00:00 AM
  </code></pre>
  
  <p>I am trying something like below:</p>
  
  <pre><code>private void GenerateReportWithStartTimeandEndTime(string StartTime, string EndTime, string DailyTime)
  {
      DateTime tempStartTime = DateTime.ParseExact(StartTime, "HH:mm:ss tt", CultureInfo.InvariantCulture);
      DateTime tempEndTime = DateTime.ParseExact(EndTime, "HH:mm:ss tt", CultureInfo.InvariantCulture);
  
      DateTime midNightToday = DateTime.Today.AddDays(1);
      var StarthourDifference = (midNightToday - tempStartTime).TotalHours;
      var EndhourDifference = (midNightToday - tempEndTime).TotalHours;
      if (StarthourDifference - EndhourDifference &gt; 0)
      {
  
      }
      else
      {
  
      }
  }
  </code></pre>