ISO8601d: Upgraded method from private to static public
This commit is contained in:
@@ -826,16 +826,6 @@ bool ISO8601d::parse_time_off_ext (Nibbler& n)
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Using Zeller's Congruence.
|
||||
int ISO8601d::dayOfWeek (int year, int month, int day)
|
||||
{
|
||||
int adj = (14 - month) / 12;
|
||||
int m = month + 12 * adj - 2;
|
||||
int y = year - adj;
|
||||
return (day + (13 * m - 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Validation via simple range checking.
|
||||
bool ISO8601d::validate ()
|
||||
@@ -1483,6 +1473,17 @@ int ISO8601d::dayOfWeek (const std::string& input)
|
||||
return -1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Using Zeller's Congruence.
|
||||
// Static
|
||||
int ISO8601d::dayOfWeek (int year, int month, int day)
|
||||
{
|
||||
int adj = (14 - month) / 12;
|
||||
int m = month + 12 * adj - 2;
|
||||
int y = year - adj;
|
||||
return (day + (13 * m - 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Static
|
||||
int ISO8601d::monthOfYear (const std::string& input)
|
||||
|
||||
Reference in New Issue
Block a user