These are really good libraries that got my dates and times flowing client-server full circle, with all the UI and math tools I needed.

KISS!


  // Date sanitation: limit ancient and future days and ensure start isn't beyond end
  date today = second_clock::local_time().date();
  date s = startdate;
  date e = enddate;
  if (e > today)
    e = today;    
  if (e - s > date_duration(cn_max_days_to_look_back))
    s = e - date_duration(cn_max_days_to_look_back);
  if (s > e)
    s = e;

Leave a Reply