ISO8601d: Added ::startOfWeek
This commit is contained in:
@@ -846,6 +846,14 @@ ISO8601d ISO8601d::startOfDay () const
|
|||||||
return ISO8601d (month (), day (), year ());
|
return ISO8601d (month (), day (), year ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
ISO8601d ISO8601d::startOfWeek () const
|
||||||
|
{
|
||||||
|
ISO8601d sow (_date);
|
||||||
|
sow -= (dayOfWeek () * 86400);
|
||||||
|
return ISO8601d (sow.month (), sow.day (), sow.year ());
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Static
|
// Static
|
||||||
bool ISO8601d::leapYear (int year)
|
bool ISO8601d::leapYear (int year)
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public:
|
|||||||
bool parse (const std::string&, std::string::size_type&, const std::string& format = "");
|
bool parse (const std::string&, std::string::size_type&, const std::string& format = "");
|
||||||
|
|
||||||
ISO8601d startOfDay () const;
|
ISO8601d startOfDay () const;
|
||||||
|
ISO8601d startOfWeek () const;
|
||||||
|
|
||||||
static bool leapYear (int);
|
static bool leapYear (int);
|
||||||
static int daysInMonth (int, int);
|
static int daysInMonth (int, int);
|
||||||
|
|||||||
Reference in New Issue
Block a user