Aggiunte funzioni per settare giorno, mese, anno e per mettere la data
all'ultimo giorno del mese git-svn-id: svn://10.65.10.50/trunk@195 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1d89b5cf66
commit
a947a1c109
@ -99,6 +99,37 @@ TDate::TDate(int day, int month, int year)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TDate::set_end_month()
|
||||||
|
// parse_filastrok(
|
||||||
|
// "trenta giorni case novembre
|
||||||
|
// con april, giugno e settembre
|
||||||
|
// case ventotto ce n'e' uno
|
||||||
|
// per default ce n'ha trentuno");
|
||||||
|
{
|
||||||
|
int d;
|
||||||
|
switch(month())
|
||||||
|
{
|
||||||
|
case 4:
|
||||||
|
case 6:
|
||||||
|
case 9:
|
||||||
|
case 11:
|
||||||
|
d = 30;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
d = year() % 4 ? 28 : 29;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
d = 31;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_val = makedata(d,month(),year());
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDate::set_day(int n) { _val = makedata(n, month(), year()); }
|
||||||
|
void TDate::set_month(int n) { _val = makedata(day(), n, year()); }
|
||||||
|
void TDate::set_year(int n) { _val = makedata(day(), month(), n); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TDate::operator const char*() const
|
TDate::operator const char*() const
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,13 @@ public:
|
|||||||
bool ok() const; // Vero se la data e' corretta
|
bool ok() const; // Vero se la data e' corretta
|
||||||
static bool isdate(const char*); // Vero se la stringa passata e' una data corretta
|
static bool isdate(const char*); // Vero se la stringa passata e' una data corretta
|
||||||
|
|
||||||
|
void set_end_month(); // setta il giorno del mese all'ultimo possibile
|
||||||
|
// implementando la filastrocchina
|
||||||
|
|
||||||
|
void set_day(int n);
|
||||||
|
void set_month(int n);
|
||||||
|
void set_year(int n);
|
||||||
|
|
||||||
// @DES Ridefiniti gli operatori: += -= ++ -- >> e <<
|
// @DES Ridefiniti gli operatori: += -= ++ -- >> e <<
|
||||||
// @FPUB
|
// @FPUB
|
||||||
TDate& operator +=(const long nday) { _val += nday; return *this; }
|
TDate& operator +=(const long nday) { _val += nday; return *this; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user