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