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