Dates
- Added Date::startof{Day,Week,Month,Year} methods to facilitate the
history, ghistory and burndown charts.
This commit is contained in:
26
src/Date.cpp
26
src/Date.cpp
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user