- Added Date::startof{Day,Week,Month,Year} methods to facilitate the
  history, ghistory and burndown charts.
This commit is contained in:
Paul Beckingham 2010-11-15 11:43:21 -05:00
parent 891136788f
commit 125058093f
3 changed files with 40 additions and 1 deletions

View file

@ -460,6 +460,32 @@ const std::string Date::toString (const std::string& format /*= "m/d/Y" */) cons
return formatted;
}
////////////////////////////////////////////////////////////////////////////////
Date Date::startOfDay () const
{
return Date (month (), day (), year ());
}
////////////////////////////////////////////////////////////////////////////////
Date Date::startOfWeek () const
{
Date sow (mT);
sow -= (dayOfWeek () * 86400);
return Date (sow.month (), sow.day (), sow.year ());
}
////////////////////////////////////////////////////////////////////////////////
Date Date::startOfMonth () const
{
return Date (month (), 1, year ());
}
////////////////////////////////////////////////////////////////////////////////
Date Date::startOfYear () const
{
return Date (1, 1, year ());
}
////////////////////////////////////////////////////////////////////////////////
bool Date::valid (const std::string& input, const std::string& format)
{