]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxDate}}\label{wxdate} |
2 | ||
3 | A class for manipulating dates. | |
4 | ||
5b6aa0ff JS |
5 | NOTE: this class should be |
6 | used with caution, since it is not fully tested. It may be replaced | |
7 | with a new class in the near future. | |
8 | ||
a660d684 KB |
9 | \wxheading{Derived from} |
10 | ||
11 | \helpref{wxObject}{wxobject} | |
12 | ||
13 | \wxheading{See also} | |
14 | ||
15 | \helpref{wxTime}{wxtime} | |
16 | ||
17 | \latexignore{\rtfignore{\wxheading{Members}}} | |
18 | ||
19 | \membersection{wxDate::wxDate}\label{wxdateconstr} | |
20 | ||
21 | \func{}{wxDate}{\void} | |
22 | ||
23 | Default constructor. | |
24 | ||
25 | \func{}{wxDate}{\param{const wxDate\&}{ date}} | |
26 | ||
27 | Copy constructor. | |
28 | ||
eaaa6a06 | 29 | \func{}{wxDate}{\param{int}{ month}, \param{int}{ day}, \param{int}{ year}} |
a660d684 KB |
30 | |
31 | Constructor taking month, day and year. | |
32 | ||
eaaa6a06 | 33 | \func{}{wxDate}{\param{long}{ julian}} |
a660d684 KB |
34 | |
35 | Constructor taking an integer representing the Julian date. This is the number of days since | |
36 | 1st January 4713 B.C., so to convert from the number of days since 1st January 1901, | |
37 | construct a date for 1/1/1901, and add the number of days. | |
38 | ||
39 | \func{}{wxDate}{\param{const wxString\& }{dateString}} | |
40 | ||
41 | Constructor taking a string representing a date. This must be either the string TODAY, or of the | |
42 | form {\tt MM/DD/YYYY} or {\tt MM-DD-YYYY}. For example: | |
43 | ||
44 | \begin{verbatim} | |
45 | wxDate date("11/26/1966"); | |
46 | \end{verbatim} | |
47 | ||
48 | \wxheading{Parameters} | |
49 | ||
50 | \docparam{date}{Date to copy.} | |
51 | ||
52 | \docparam{month}{Month: a number between 1 and 12.} | |
53 | ||
54 | \docparam{day}{Day: a number between 1 and 31.} | |
55 | ||
56 | \docparam{year}{Year, such as 1995, 2005.} | |
57 | ||
58 | \membersection{wxDate::\destruct{wxDate}} | |
59 | ||
60 | \func{void}{\destruct{wxDate}}{\void} | |
61 | ||
62 | Destructor. | |
63 | ||
64 | \membersection{wxDate::AddMonths}\label{wxdateaddmonths} | |
65 | ||
eaaa6a06 | 66 | \func{wxDate\&}{AddMonths}{\param{int}{ months=1}} |
a660d684 KB |
67 | |
68 | Adds the given number of months to the date, returning a reference to `this'. | |
69 | ||
70 | \membersection{wxDate::AddWeeks}\label{wxdateaddweeks} | |
71 | ||
eaaa6a06 | 72 | \func{wxDate\&}{AddWeeks}{\param{int}{ weeks=1}} |
a660d684 KB |
73 | |
74 | Adds the given number of weeks to the date, returning a reference to `this'. | |
75 | ||
76 | \membersection{wxDate::AddYears}\label{wxdateaddyears} | |
77 | ||
eaaa6a06 | 78 | \func{wxDate\&}{AddYears}{\param{int}{ years=1}} |
a660d684 KB |
79 | |
80 | Adds the given number of months to the date, returning a reference to `this'. | |
81 | ||
82 | \membersection{wxDate::FormatDate}\label{wxdateformatdate} | |
83 | ||
eaaa6a06 | 84 | \constfunc{wxString}{FormatDate}{\param{int}{ type=-1}} |
a660d684 KB |
85 | |
86 | Formats the date according to {\it type} if not -1, or according | |
87 | to the current display type if -1. | |
88 | ||
89 | \wxheading{Parameters} | |
90 | ||
91 | \docparam{type}{-1 or one of: | |
92 | ||
93 | \begin{twocollist}\itemsep=0pt | |
94 | \twocolitem{wxDAY}{Format day only.} | |
95 | \twocolitem{wxMONTH}{Format month only.} | |
96 | \twocolitem{wxMDY}{Format MONTH, DAY, YEAR.} | |
97 | \twocolitem{wxFULL}{Format day, month and year in US style: DAYOFWEEK, MONTH, DAY, YEAR.} | |
98 | \twocolitem{wxEUROPEAN}{Format day, month and year in European style: DAY, MONTH, YEAR.} | |
99 | \end{twocollist}} | |
100 | ||
101 | \membersection{wxDate::GetDay}\label{wxdategetday} | |
102 | ||
103 | \constfunc{int}{GetDay}{\void} | |
104 | ||
105 | Returns the numeric day (in the range 1 to 31). | |
106 | ||
107 | \membersection{wxDate::GetDayOfWeek}\label{wxdategetdayofweek} | |
108 | ||
109 | \constfunc{int}{GetDayOfWeek}{\void} | |
110 | ||
111 | Returns the integer day of the week (in the range 1 to 7). | |
112 | ||
113 | \membersection{wxDate::GetDayOfWeekName}\label{wxdategetdayofweekname} | |
114 | ||
115 | \constfunc{wxString}{GetDayOfWeekName}{\void} | |
116 | ||
117 | Returns the name of the day of week. | |
118 | ||
119 | \membersection{wxDate::GetDayOfYear}\label{wxdategetdayofyear} | |
120 | ||
121 | \constfunc{long}{GetDayOfYear}{\void} | |
122 | ||
123 | Returns the day of the year (from 1 to 365). | |
124 | ||
125 | \membersection{wxDate::GetDaysInMonth}\label{wxdategetdaysinmonth} | |
126 | ||
127 | \constfunc{int}{GetDaysInMonth}{\void} | |
128 | ||
129 | Returns the number of days in the month (in the range 1 to 31). | |
130 | ||
131 | \membersection{wxDate::GetFirstDayOfMonth}\label{wxdategetfirstdayofmonth} | |
132 | ||
133 | \constfunc{int}{GetFirstDayOfMonth}{\void} | |
134 | ||
135 | Returns the day of week that is first in the month (in the range 1 to 7). | |
136 | ||
137 | \membersection{wxDate::GetJulianDate}\label{wxdategetjuliandate} | |
138 | ||
139 | \constfunc{long}{GetJulianDate}{\void} | |
140 | ||
141 | Returns the Julian date. | |
142 | ||
143 | \membersection{wxDate::GetMonth}\label{wxdategetmonth} | |
144 | ||
145 | \constfunc{int}{GetMonth}{\void} | |
146 | ||
147 | Returns the month number (in the range 1 to 12). | |
148 | ||
149 | \membersection{wxDate::GetMonthEnd} | |
150 | ||
151 | \func{wxDate}{GetMonthEnd}{\void} | |
152 | ||
153 | Returns the date representing the last day of the month. | |
154 | ||
155 | \membersection{wxDate::GetMonthName}\label{wxdategetmonthname} | |
156 | ||
157 | \constfunc{wxString}{GetMonthName}{\void} | |
158 | ||
159 | Returns the name of the month. Do not delete the returned storage. | |
160 | ||
161 | \membersection{wxDate::GetMonthStart}\label{wxdategetmonthstart} | |
162 | ||
163 | \constfunc{wxDate}{GetMonthStart}{\void} | |
164 | ||
165 | Returns the date representing the first day of the month. | |
166 | ||
167 | \membersection{wxDate::GetWeekOfMonth}\label{wxdategetweekofmonth} | |
168 | ||
169 | \constfunc{int}{GetWeekOfMonth}{\void} | |
170 | ||
171 | Returns the week of month (in the range 1 to 6). | |
172 | ||
173 | \membersection{wxDate::GetWeekOfYear}\label{wxdategetweekofyear} | |
174 | ||
175 | \constfunc{int}{GetWeekOfYear}{\void} | |
176 | ||
177 | Returns the week of year (in the range 1 to 52). | |
178 | ||
179 | \membersection{wxDate::GetYear}\label{wxdategetyear} | |
180 | ||
181 | \constfunc{int}{GetYear}{\void} | |
182 | ||
183 | Returns the year as an integer (such as `1995'). | |
184 | ||
185 | \membersection{wxDate::GetYearEnd}\label{wxdategetyearend} | |
186 | ||
187 | \constfunc{wxDate}{GetYearEnd}{\void} | |
188 | ||
189 | Returns the date representing the last day of the year. | |
190 | ||
191 | \membersection{wxDate::GetYearStart}\label{wxdategetyearstart} | |
192 | ||
193 | \constfunc{wxDate}{GetYearStart}{\void} | |
194 | ||
195 | Returns the date representing the first day of the year. | |
196 | ||
197 | \membersection{wxDate::IsLeapYear}\label{wxdateisleapyear} | |
198 | ||
199 | \constfunc{bool}{IsLeapYear}{\void} | |
200 | ||
201 | Returns TRUE if the year of this date is a leap year. | |
202 | ||
203 | \membersection{wxDate::Set}\label{wxdateset} | |
204 | ||
205 | \func{wxDate\&}{Set}{\void} | |
206 | ||
207 | Sets the date to current system date, returning a reference to `this'. | |
208 | ||
eaaa6a06 | 209 | \func{wxDate\&}{Set}{\param{long}{ julian}} |
a660d684 KB |
210 | |
211 | Sets the date to the given Julian date, returning a reference to `this'. | |
212 | ||
eaaa6a06 | 213 | \func{wxDate\&}{Set}{\param{int}{ month}, \param{int}{ day}, \param{int}{ year}} |
a660d684 KB |
214 | |
215 | Sets the date to the given date, returning a reference to `this'. | |
216 | ||
217 | {\it month} is a number from 1 to 12. | |
218 | ||
219 | {\it day} is a number from 1 to 31. | |
220 | ||
221 | {\it year} is a year, such as 1995, 2005. | |
222 | ||
223 | \membersection{wxDate::SetFormat}\label{wxdatesetformat} | |
224 | ||
eaaa6a06 | 225 | \func{void}{SetFormat}{\param{int}{ format}} |
a660d684 KB |
226 | |
227 | Sets the current format type. | |
228 | ||
229 | \wxheading{Parameters} | |
230 | ||
231 | \docparam{format}{-1 or one of: | |
232 | ||
233 | \twocolwidtha{5cm} | |
234 | \begin{twocollist}\itemsep=0pt | |
235 | \twocolitem{{\bf wxDAY}}{Format day only.} | |
236 | \twocolitem{{\bf wxMONTH}}{Format month only.} | |
237 | \twocolitem{{\bf wxMDY}}{Format MONTH, DAY, YEAR.} | |
238 | \twocolitem{{\bf wxFULL}}{Format day, month and year in US style: DAYOFWEEK, MONTH, DAY, YEAR.} | |
239 | \twocolitem{{\bf wxEUROPEAN}}{Format day, month and year in European style: DAY, MONTH, YEAR.} | |
240 | \end{twocollist}} | |
241 | ||
242 | \membersection{wxDate::SetOption}\label{wxdatesetoption} | |
243 | ||
eaaa6a06 | 244 | \func{int}{SetOption}{\param{int}{ option}, \param{const bool}{ enable=TRUE}} |
a660d684 KB |
245 | |
246 | Enables or disables an option for formatting. | |
247 | ||
248 | \wxheading{Parameters} | |
249 | ||
250 | \docparam{option}{May be one of: | |
251 | ||
252 | \twocolwidtha{5cm} | |
253 | \begin{twocollist}\itemsep=0pt | |
254 | \twocolitem{{\bf wxNO\_CENTURY}}{The century is not formatted.} | |
255 | \twocolitem{{\bf wxDATE\_ABBR}}{Month and day names are abbreviated to 3 characters when formatting.} | |
256 | \end{twocollist}} | |
257 | ||
258 | \membersection{wxDate::operator wxString}\label{wxdatewxstring} | |
259 | ||
260 | \func{}{operator wxString}{\void} | |
261 | ||
262 | Conversion operator, to convert wxDate to wxString by calling FormatDate. | |
263 | ||
264 | \membersection{wxDate::operator $+$}\label{wxdateplus} | |
265 | ||
eaaa6a06 | 266 | \func{wxDate}{operator $+$}{\param{long}{ i}} |
a660d684 | 267 | |
eaaa6a06 | 268 | \func{wxDate}{operator $+$}{\param{int}{ i}} |
a660d684 KB |
269 | |
270 | Adds an integer number of days to the date, returning a date. | |
271 | ||
272 | \membersection{wxDate::operator $-$}\label{wxdateminus} | |
273 | ||
eaaa6a06 | 274 | \func{wxDate}{operator $-$}{\param{long}{ i}} |
a660d684 | 275 | |
eaaa6a06 | 276 | \func{wxDate}{operator $-$}{\param{int}{ i}} |
a660d684 KB |
277 | |
278 | Subtracts an integer number of days from the date, returning a date. | |
279 | ||
280 | \func{long}{operator $-$}{\param{const wxDate\&}{ date}} | |
281 | ||
282 | Subtracts one date from another, return the number of intervening days. | |
283 | ||
284 | \membersection{wxDate::operator $+=$}\label{wxdateplusequals} | |
285 | ||
eaaa6a06 | 286 | \func{wxDate\&}{operator $+=$}{\param{long}{ i}} |
a660d684 KB |
287 | |
288 | Postfix operator: adds an integer number of days to the date, returning | |
289 | a reference to `this' date. | |
290 | ||
291 | \membersection{wxDate::operator $-=$}\label{wxdateminusequals} | |
292 | ||
eaaa6a06 | 293 | \func{wxDate\&}{operator $-=$}{\param{long}{ i}} |
a660d684 KB |
294 | |
295 | Postfix operator: subtracts an integer number of days from the date, returning | |
296 | a reference to `this' date. | |
297 | ||
298 | \membersection{wxDate::operator $++$}\label{wxdateplusplus} | |
299 | ||
300 | \func{wxDate\&}{operator $++$}{\void} | |
301 | ||
302 | Increments the date (postfix or prefix). | |
303 | ||
304 | \membersection{wxDate::operator $--$}\label{wxdateminusminus} | |
305 | ||
306 | \func{wxDate\&}{operator $--$}{\void} | |
307 | ||
308 | Decrements the date (postfix or prefix). | |
309 | ||
310 | \membersection{wxDate::operator $<$}\label{wxdatelessthan} | |
311 | ||
312 | \func{friend bool}{operator $<$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}} | |
313 | ||
314 | Function to compare two dates, returning TRUE if {\it date1} is earlier than {\it date2}. | |
315 | ||
316 | \membersection{wxDate::operator $<=$}\label{wxdatelessthaneq} | |
317 | ||
318 | \func{friend bool}{operator $<=$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}} | |
319 | ||
320 | Function to compare two dates, returning TRUE if {\it date1} is earlier than or equal to {\it date2}. | |
321 | ||
322 | \membersection{wxDate::operator $>$}\label{wxdategreaterthan} | |
323 | ||
324 | \func{friend bool}{operator $>$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}} | |
325 | ||
326 | Function to compare two dates, returning TRUE if {\it date1} is later than {\it date2}. | |
327 | ||
328 | \membersection{wxDate::operator $>=$}\label{wxdategreaterthaneq} | |
329 | ||
330 | \func{friend bool}{operator $>=$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}} | |
331 | ||
332 | Function to compare two dates, returning TRUE if {\it date1} is later than or equal to {\it date2}. | |
333 | ||
334 | \membersection{wxDate::operator $==$}\label{wxdateequals} | |
335 | ||
336 | \func{friend bool}{operator $==$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}} | |
337 | ||
338 | Function to compare two dates, returning TRUE if {\it date1} is equal to {\it date2}. | |
339 | ||
340 | \membersection{wxDate::operator $!=$}\label{wxdatenotequals} | |
341 | ||
342 | \func{friend bool}{operator $!=$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}} | |
343 | ||
344 | Function to compare two dates, returning TRUE if {\it date1} is not equal to {\it date2}. | |
345 | ||
346 | \membersection{wxDate::operator \cinsert}\label{wxdateinsert} | |
347 | ||
348 | \func{friend ostream\&}{operator \cinsert}{\param{ostream\&}{ os}, \param{const wxDate\&}{ date}} | |
349 | ||
350 | Function to output a wxDate to an ostream. | |
351 | ||
352 |