From fb0c044fcdf0718c65dfc176d36f4a13ba16b7a1 Mon Sep 17 00:00:00 2001 From: augusto Date: Tue, 3 Jun 1997 09:45:44 +0000 Subject: [PATCH] Aggiunto il lmetodo week() git-svn-id: svn://10.65.10.50/trunk@4495 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/date.cpp | 11 ++++++++++- include/date.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/date.cpp b/include/date.cpp index a672e2498..483df174f 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -370,7 +370,6 @@ int TDate::day() const return (int) (_val % 100L); } - int TDate::month() const { return (int) ((_val % 10000L) / 100L); @@ -384,6 +383,16 @@ int TDate::year() const } +int TDate::week() const + +{ + TDate y(*this); + y.set_day(1); + y.set_month(1); + return (int) ((date2julian()-y.date2julian())/7 )+1; +} + + void TDate::addmonth(int nmonth) { diff --git a/include/date.h b/include/date.h index 23b5e28be..1ef110aa6 100755 --- a/include/date.h +++ b/include/date.h @@ -83,6 +83,8 @@ public: int year() const ; // @cmember Ritorna il giorno della settimana (0 = domenica) int wday() const ; + // @cmember Ritorna la settimana dell'anno + int week() const ; // @cmember Aggiunge dei mesi void addmonth(int nmonth = 1); // @cmember Aggiunge degli anni