wochentagsberechnung gefixed
This commit is contained in:
+11
-6
@@ -72,16 +72,18 @@ void datum::ausgeben() {
|
||||
|
||||
int datum::wochentag()
|
||||
{
|
||||
string yearst = to_string(jahr);
|
||||
int year = jahr;
|
||||
int m = monat;
|
||||
if (m < 3)
|
||||
year--;
|
||||
|
||||
string yearst = to_string(year);
|
||||
string cst = yearst.substr(0, 2);
|
||||
string yst = yearst.substr(2, 4);
|
||||
int y = stoi(yst);
|
||||
int c = stoi(cst);
|
||||
int d = tag;
|
||||
int m = monat;
|
||||
|
||||
if (m < 3)
|
||||
y--;
|
||||
|
||||
|
||||
if (m == 1 || m == 2)
|
||||
m += 10;
|
||||
@@ -118,8 +120,11 @@ int datum::kwBerechnen()
|
||||
int offset = 0;
|
||||
int kw = 0;
|
||||
|
||||
if (wochentagErste < 4)
|
||||
if (wochentagErste < 4) {
|
||||
offset = wochentagErste - 2;
|
||||
kw += 1;
|
||||
}
|
||||
|
||||
else
|
||||
offset = (8 - wochentagErste) % 7;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user