Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Function template days_before_weekday

boost::date_time::days_before_weekday — Calculates the number of days since the previous weekday.


// In header: <boost/date_time/date_generators.hpp>

template<typename date_type, typename weekday_type> 
  days_before_weekday(const date_type & d, const weekday_type & wd);


Calculates the number of days since the previous weekday If the date given falls on a Sunday and the given weekday is Tuesday the result will be 5 days. The answer will be a positive number because Tuesday is 5 days before Sunday, not -5 days before.