]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/date.tex
wxSize/wxPoint/wxRect versions of functions added to wxMSW, wxMotif;
[wxWidgets.git] / docs / latex / wx / date.tex
CommitLineData
a660d684
KB
1\section{\class{wxDate}}\label{wxdate}
2
3A 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
19Default constructor.
20
21\func{}{wxDate}{\param{const wxDate\&}{ date}}
22
23Copy constructor.
24
eaaa6a06 25\func{}{wxDate}{\param{int}{ month}, \param{int}{ day}, \param{int}{ year}}
a660d684
KB
26
27Constructor taking month, day and year.
28
eaaa6a06 29\func{}{wxDate}{\param{long}{ julian}}
a660d684
KB
30
31Constructor taking an integer representing the Julian date. This is the number of days since
321st January 4713 B.C., so to convert from the number of days since 1st January 1901,
33construct a date for 1/1/1901, and add the number of days.
34
35\func{}{wxDate}{\param{const wxString\& }{dateString}}
36
37Constructor taking a string representing a date. This must be either the string TODAY, or of the
38form {\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
58Destructor.
59
60\membersection{wxDate::AddMonths}\label{wxdateaddmonths}
61
eaaa6a06 62\func{wxDate\&}{AddMonths}{\param{int}{ months=1}}
a660d684
KB
63
64Adds the given number of months to the date, returning a reference to `this'.
65
66\membersection{wxDate::AddWeeks}\label{wxdateaddweeks}
67
eaaa6a06 68\func{wxDate\&}{AddWeeks}{\param{int}{ weeks=1}}
a660d684
KB
69
70Adds the given number of weeks to the date, returning a reference to `this'.
71
72\membersection{wxDate::AddYears}\label{wxdateaddyears}
73
eaaa6a06 74\func{wxDate\&}{AddYears}{\param{int}{ years=1}}
a660d684
KB
75
76Adds the given number of months to the date, returning a reference to `this'.
77
78\membersection{wxDate::FormatDate}\label{wxdateformatdate}
79
eaaa6a06 80\constfunc{wxString}{FormatDate}{\param{int}{ type=-1}}
a660d684
KB
81
82Formats the date according to {\it type} if not -1, or according
83to 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
101Returns the numeric day (in the range 1 to 31).
102
103\membersection{wxDate::GetDayOfWeek}\label{wxdategetdayofweek}
104
105\constfunc{int}{GetDayOfWeek}{\void}
106
107Returns 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
113Returns the name of the day of week.
114
115\membersection{wxDate::GetDayOfYear}\label{wxdategetdayofyear}
116
117\constfunc{long}{GetDayOfYear}{\void}
118
119Returns the day of the year (from 1 to 365).
120
121\membersection{wxDate::GetDaysInMonth}\label{wxdategetdaysinmonth}
122
123\constfunc{int}{GetDaysInMonth}{\void}
124
125Returns 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
131Returns 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
137Returns the Julian date.
138
139\membersection{wxDate::GetMonth}\label{wxdategetmonth}
140
141\constfunc{int}{GetMonth}{\void}
142
143Returns the month number (in the range 1 to 12).
144
145\membersection{wxDate::GetMonthEnd}
146
147\func{wxDate}{GetMonthEnd}{\void}
148
149Returns the date representing the last day of the month.
150
151\membersection{wxDate::GetMonthName}\label{wxdategetmonthname}
152
153\constfunc{wxString}{GetMonthName}{\void}
154
155Returns 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
161Returns the date representing the first day of the month.
162
163\membersection{wxDate::GetWeekOfMonth}\label{wxdategetweekofmonth}
164
165\constfunc{int}{GetWeekOfMonth}{\void}
166
167Returns the week of month (in the range 1 to 6).
168
169\membersection{wxDate::GetWeekOfYear}\label{wxdategetweekofyear}
170
171\constfunc{int}{GetWeekOfYear}{\void}
172
173Returns the week of year (in the range 1 to 52).
174
175\membersection{wxDate::GetYear}\label{wxdategetyear}
176
177\constfunc{int}{GetYear}{\void}
178
179Returns the year as an integer (such as `1995').
180
181\membersection{wxDate::GetYearEnd}\label{wxdategetyearend}
182
183\constfunc{wxDate}{GetYearEnd}{\void}
184
185Returns the date representing the last day of the year.
186
187\membersection{wxDate::GetYearStart}\label{wxdategetyearstart}
188
189\constfunc{wxDate}{GetYearStart}{\void}
190
191Returns the date representing the first day of the year.
192
193\membersection{wxDate::IsLeapYear}\label{wxdateisleapyear}
194
195\constfunc{bool}{IsLeapYear}{\void}
196
197Returns 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
203Sets the date to current system date, returning a reference to `this'.
204
eaaa6a06 205\func{wxDate\&}{Set}{\param{long}{ julian}}
a660d684
KB
206
207Sets the date to the given Julian date, returning a reference to `this'.
208
eaaa6a06 209\func{wxDate\&}{Set}{\param{int}{ month}, \param{int}{ day}, \param{int}{ year}}
a660d684
KB
210
211Sets 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
eaaa6a06 221\func{void}{SetFormat}{\param{int}{ format}}
a660d684
KB
222
223Sets 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
eaaa6a06 240\func{int}{SetOption}{\param{int}{ option}, \param{const bool}{ enable=TRUE}}
a660d684
KB
241
242Enables 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
258Conversion operator, to convert wxDate to wxString by calling FormatDate.
259
260\membersection{wxDate::operator $+$}\label{wxdateplus}
261
eaaa6a06 262\func{wxDate}{operator $+$}{\param{long}{ i}}
a660d684 263
eaaa6a06 264\func{wxDate}{operator $+$}{\param{int}{ i}}
a660d684
KB
265
266Adds an integer number of days to the date, returning a date.
267
268\membersection{wxDate::operator $-$}\label{wxdateminus}
269
eaaa6a06 270\func{wxDate}{operator $-$}{\param{long}{ i}}
a660d684 271
eaaa6a06 272\func{wxDate}{operator $-$}{\param{int}{ i}}
a660d684
KB
273
274Subtracts an integer number of days from the date, returning a date.
275
276\func{long}{operator $-$}{\param{const wxDate\&}{ date}}
277
278Subtracts one date from another, return the number of intervening days.
279
280\membersection{wxDate::operator $+=$}\label{wxdateplusequals}
281
eaaa6a06 282\func{wxDate\&}{operator $+=$}{\param{long}{ i}}
a660d684
KB
283
284Postfix operator: adds an integer number of days to the date, returning
285a reference to `this' date.
286
287\membersection{wxDate::operator $-=$}\label{wxdateminusequals}
288
eaaa6a06 289\func{wxDate\&}{operator $-=$}{\param{long}{ i}}
a660d684
KB
290
291Postfix operator: subtracts an integer number of days from the date, returning
292a reference to `this' date.
293
294\membersection{wxDate::operator $++$}\label{wxdateplusplus}
295
296\func{wxDate\&}{operator $++$}{\void}
297
298Increments the date (postfix or prefix).
299
300\membersection{wxDate::operator $--$}\label{wxdateminusminus}
301
302\func{wxDate\&}{operator $--$}{\void}
303
304Decrements 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
310Function 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
316Function 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
322Function 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
328Function 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
334Function 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
340Function 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
346Function to output a wxDate to an ostream.
347
348