2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGExtensions_NSCalendarDate_misc_H__
24 #define __NGExtensions_NSCalendarDate_misc_H__
26 #import <Foundation/NSDate.h>
28 #if NeXT_Foundation_LIBRARY || GNUSTEP_BASE_LIBRARY
29 # import <Foundation/NSCalendarDate.h>
32 @interface NSCalendarDate(misc)
36 - (short)numberOfWeeksInYear;
37 + (NSArray *)mondaysOfYear:(int)_year timeZone:(NSTimeZone *)_tz;
38 - (NSArray *)mondaysOfYear;
39 - (NSCalendarDate *)firstMondayAndLastWeekInYear:(short *)_lastWeek;
40 + (NSCalendarDate *)mondayOfWeek:(int)_weekNumber inYear:(int)_year
41 timeZone:(NSTimeZone *)_tz;
42 - (NSCalendarDate *)mondayOfWeek:(int)_weekNumber;
44 - (NSCalendarDate *)firstDayOfMonth;
45 - (NSCalendarDate *)lastDayOfMonth;
46 - (NSCalendarDate *)mondayOfWeek;
47 - (NSCalendarDate *)beginOfDay;
48 - (NSCalendarDate *)endOfDay;
49 - (int)numberOfDaysInMonth;
51 - (BOOL)isDateOnSameDay:(NSCalendarDate *)_date;
52 - (BOOL)isDateInSameWeek:(NSCalendarDate *)_date;
56 - (NSCalendarDate *)yesterday;
57 - (NSCalendarDate *)tomorrow;
61 - (NSCalendarDate *)nextYear;
62 - (NSCalendarDate *)lastYear;
64 /* returns a date on the same day with the specified time */
65 - (NSCalendarDate *)hour:(int)_hour minute:(int)_minute second:(int)_second;
66 - (NSCalendarDate *)hour:(int)_hour minute:(int)_minute;
69 applies the following modifications:
70 if year >= 70 && year < 135
72 elif year >= 0 && year < 70
76 - (NSCalendarDate *)y2kDate;
79 adding years, months and days while *keeping* the clock time, eg:
81 d1 = [NSCalendarDate dateWithYear:2000 month:2 day:15
82 hour:12 minute:0 second:0
84 d2 = [d1 dateByAddingYear:0 month:3 day:0];
86 [d2 hourOfDay] will be '15' though the timezone changed from
89 -dateByAddingYears:months:days:hours:minutes:seconds: which can
90 be found in NSCalendarDate will not keep the clock time (the time
91 will be adjusted in the new DST timezone
94 - (NSCalendarDate *)dateByAddingYears:(int)_years
98 /* calculate easter ... */
100 - (NSCalendarDate *)easterOfYear;
104 #endif /* __NGExtensions_NSCalendarDate_misc_H__ */