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