1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
|
<HTML>
<head><title>wxDate</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxdate"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx63.htm#wxdataoutputstream"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx65.htm#wxdc"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxDate</H2>
<P>
A class for manipulating dates.<P>
<B>NOTE:</B> this class should be
used with caution, since it is not fully tested. It will be replaced
with a new wxDateTime class in the near future.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/date.h><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx247.htm#wxtime">wxTime</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxdateconstr">wxDate::wxDate</A><BR>
<A HREF="#topic189">wxDate::~wxDate</A><BR>
<A HREF="#wxdateaddmonths">wxDate::AddMonths</A><BR>
<A HREF="#wxdateaddweeks">wxDate::AddWeeks</A><BR>
<A HREF="#wxdateaddyears">wxDate::AddYears</A><BR>
<A HREF="#wxdateformatdate">wxDate::FormatDate</A><BR>
<A HREF="#wxdategetday">wxDate::GetDay</A><BR>
<A HREF="#wxdategetdayofweek">wxDate::GetDayOfWeek</A><BR>
<A HREF="#wxdategetdayofweekname">wxDate::GetDayOfWeekName</A><BR>
<A HREF="#wxdategetdayofyear">wxDate::GetDayOfYear</A><BR>
<A HREF="#wxdategetdaysinmonth">wxDate::GetDaysInMonth</A><BR>
<A HREF="#wxdategetfirstdayofmonth">wxDate::GetFirstDayOfMonth</A><BR>
<A HREF="#wxdategetjuliandate">wxDate::GetJulianDate</A><BR>
<A HREF="#wxdategetmonth">wxDate::GetMonth</A><BR>
<A HREF="#topic190">wxDate::GetMonthEnd</A><BR>
<A HREF="#wxdategetmonthname">wxDate::GetMonthName</A><BR>
<A HREF="#wxdategetmonthstart">wxDate::GetMonthStart</A><BR>
<A HREF="#wxdategetweekofmonth">wxDate::GetWeekOfMonth</A><BR>
<A HREF="#wxdategetweekofyear">wxDate::GetWeekOfYear</A><BR>
<A HREF="#wxdategetyear">wxDate::GetYear</A><BR>
<A HREF="#wxdategetyearend">wxDate::GetYearEnd</A><BR>
<A HREF="#wxdategetyearstart">wxDate::GetYearStart</A><BR>
<A HREF="#wxdateisleapyear">wxDate::IsLeapYear</A><BR>
<A HREF="#wxdateset">wxDate::Set</A><BR>
<A HREF="#wxdatesetformat">wxDate::SetFormat</A><BR>
<A HREF="#wxdatesetoption">wxDate::SetOption</A><BR>
<A HREF="#wxdatewxstring">wxDate::operator wxString</A><BR>
<A HREF="#wxdateplus">wxDate::operator +</A><BR>
<A HREF="#wxdateminus">wxDate::operator -</A><BR>
<A HREF="#wxdateplusequals">wxDate::operator +=</A><BR>
<A HREF="#wxdateminusequals">wxDate::operator -=</A><BR>
<A HREF="#wxdateplusplus">wxDate::operator ++</A><BR>
<A HREF="#wxdateminusminus">wxDate::operator --</A><BR>
<A HREF="#wxdatelessthan">wxDate::operator <</A><BR>
<A HREF="#wxdatelessthaneq">wxDate::operator <=</A><BR>
<A HREF="#wxdategreaterthan">wxDate::operator ></A><BR>
<A HREF="#wxdategreaterthaneq">wxDate::operator >=</A><BR>
<A HREF="#wxdateequals">wxDate::operator ==</A><BR>
<A HREF="#wxdatenotequals">wxDate::operator !=</A><BR>
<A HREF="#wxdateinsert">wxDate::operator <<</A><BR>
<P>
<HR>
<A NAME="wxdateconstr"></A>
<H3>wxDate::wxDate</H3>
<P>
<B></B> <B>wxDate</B>()<P>
Default constructor.<P>
<B></B> <B>wxDate</B>(<B>const wxDate&</B><I> date</I>)<P>
Copy constructor.<P>
<B></B> <B>wxDate</B>(<B>int</B><I> month</I>, <B>int</B><I> day</I>, <B>int</B><I> year</I>)<P>
Constructor taking month, day and year.<P>
<B></B> <B>wxDate</B>(<B>long</B><I> julian</I>)<P>
Constructor taking an integer representing the Julian date. This is the number of days since
1st January 4713 B.C., so to convert from the number of days since 1st January 1901,
construct a date for 1/1/1901, and add the number of days.<P>
<B></B> <B>wxDate</B>(<B>const wxString& </B><I>dateString</I>)<P>
Constructor taking a string representing a date. This must be either the string TODAY, or of the
form <TT>MM/DD/YYYY</TT> or <TT>MM-DD-YYYY</TT>. For example:<P>
<PRE>
wxDate date("11/26/1966");
</PRE>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>date</I><UL><UL>
Date to copy.</UL></UL>
<P>
<I>month</I><UL><UL>
Month: a number between 1 and 12.</UL></UL>
<P>
<I>day</I><UL><UL>
Day: a number between 1 and 31.</UL></UL>
<P>
<I>year</I><UL><UL>
Year, such as 1995, 2005.</UL></UL>
<P>
<HR>
<A NAME="topic189"></A>
<H3>wxDate::~wxDate</H3>
<P>
<B>void</B> <B>~wxDate</B>()<P>
Destructor.<P>
<HR>
<A NAME="wxdateaddmonths"></A>
<H3>wxDate::AddMonths</H3>
<P>
<B>wxDate&</B> <B>AddMonths</B>(<B>int</B><I> months=1</I>)<P>
Adds the given number of months to the date, returning a reference to 'this'.<P>
<HR>
<A NAME="wxdateaddweeks"></A>
<H3>wxDate::AddWeeks</H3>
<P>
<B>wxDate&</B> <B>AddWeeks</B>(<B>int</B><I> weeks=1</I>)<P>
Adds the given number of weeks to the date, returning a reference to 'this'.<P>
<HR>
<A NAME="wxdateaddyears"></A>
<H3>wxDate::AddYears</H3>
<P>
<B>wxDate&</B> <B>AddYears</B>(<B>int</B><I> years=1</I>)<P>
Adds the given number of months to the date, returning a reference to 'this'.<P>
<HR>
<A NAME="wxdateformatdate"></A>
<H3>wxDate::FormatDate</H3>
<P>
<B>wxString</B> <B>FormatDate</B>(<B>int</B><I> type=-1</I>) <B>const</B><P>
Formats the date according to <I>type</I> if not -1, or according
to the current display type if -1.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>type</I><UL><UL>
-1 or one of:<P>
<TABLE>
<TR><TD VALIGN=TOP>
wxDAY
</TD>
<TD VALIGN=TOP>
Format day only.
</TD></TR>
<TR><TD VALIGN=TOP>
wxMONTH
</TD>
<TD VALIGN=TOP>
Format month only.
</TD></TR>
<TR><TD VALIGN=TOP>
wxMDY
</TD>
<TD VALIGN=TOP>
Format MONTH, DAY, YEAR.
</TD></TR>
<TR><TD VALIGN=TOP>
wxFULL
</TD>
<TD VALIGN=TOP>
Format day, month and year in US style: DAYOFWEEK, MONTH, DAY, YEAR.
</TD></TR>
<TR><TD VALIGN=TOP>
wxEUROPEAN
</TD>
<TD VALIGN=TOP>
Format day, month and year in European style: DAY, MONTH, YEAR.
</TD></TR>
</TABLE>
</UL></UL>
<P>
<HR>
<A NAME="wxdategetday"></A>
<H3>wxDate::GetDay</H3>
<P>
<B>int</B> <B>GetDay</B>() <B>const</B><P>
Returns the numeric day (in the range 1 to 31).<P>
<HR>
<A NAME="wxdategetdayofweek"></A>
<H3>wxDate::GetDayOfWeek</H3>
<P>
<B>int</B> <B>GetDayOfWeek</B>() <B>const</B><P>
Returns the integer day of the week (in the range 1 to 7).<P>
<HR>
<A NAME="wxdategetdayofweekname"></A>
<H3>wxDate::GetDayOfWeekName</H3>
<P>
<B>wxString</B> <B>GetDayOfWeekName</B>() <B>const</B><P>
Returns the name of the day of week.<P>
<HR>
<A NAME="wxdategetdayofyear"></A>
<H3>wxDate::GetDayOfYear</H3>
<P>
<B>long</B> <B>GetDayOfYear</B>() <B>const</B><P>
Returns the day of the year (from 1 to 365).<P>
<HR>
<A NAME="wxdategetdaysinmonth"></A>
<H3>wxDate::GetDaysInMonth</H3>
<P>
<B>int</B> <B>GetDaysInMonth</B>() <B>const</B><P>
Returns the number of days in the month (in the range 1 to 31).<P>
<HR>
<A NAME="wxdategetfirstdayofmonth"></A>
<H3>wxDate::GetFirstDayOfMonth</H3>
<P>
<B>int</B> <B>GetFirstDayOfMonth</B>() <B>const</B><P>
Returns the day of week that is first in the month (in the range 1 to 7).<P>
<HR>
<A NAME="wxdategetjuliandate"></A>
<H3>wxDate::GetJulianDate</H3>
<P>
<B>long</B> <B>GetJulianDate</B>() <B>const</B><P>
Returns the Julian date.<P>
<HR>
<A NAME="wxdategetmonth"></A>
<H3>wxDate::GetMonth</H3>
<P>
<B>int</B> <B>GetMonth</B>() <B>const</B><P>
Returns the month number (in the range 1 to 12).<P>
<HR>
<A NAME="topic190"></A>
<H3>wxDate::GetMonthEnd</H3>
<P>
<B>wxDate</B> <B>GetMonthEnd</B>()<P>
Returns the date representing the last day of the month.<P>
<HR>
<A NAME="wxdategetmonthname"></A>
<H3>wxDate::GetMonthName</H3>
<P>
<B>wxString</B> <B>GetMonthName</B>() <B>const</B><P>
Returns the name of the month. Do not delete the returned storage.<P>
<HR>
<A NAME="wxdategetmonthstart"></A>
<H3>wxDate::GetMonthStart</H3>
<P>
<B>wxDate</B> <B>GetMonthStart</B>() <B>const</B><P>
Returns the date representing the first day of the month.<P>
<HR>
<A NAME="wxdategetweekofmonth"></A>
<H3>wxDate::GetWeekOfMonth</H3>
<P>
<B>int</B> <B>GetWeekOfMonth</B>() <B>const</B><P>
Returns the week of month (in the range 1 to 6).<P>
<HR>
<A NAME="wxdategetweekofyear"></A>
<H3>wxDate::GetWeekOfYear</H3>
<P>
<B>int</B> <B>GetWeekOfYear</B>() <B>const</B><P>
Returns the week of year (in the range 1 to 52).<P>
<HR>
<A NAME="wxdategetyear"></A>
<H3>wxDate::GetYear</H3>
<P>
<B>int</B> <B>GetYear</B>() <B>const</B><P>
Returns the year as an integer (such as '1995').<P>
<HR>
<A NAME="wxdategetyearend"></A>
<H3>wxDate::GetYearEnd</H3>
<P>
<B>wxDate</B> <B>GetYearEnd</B>() <B>const</B><P>
Returns the date representing the last day of the year.<P>
<HR>
<A NAME="wxdategetyearstart"></A>
<H3>wxDate::GetYearStart</H3>
<P>
<B>wxDate</B> <B>GetYearStart</B>() <B>const</B><P>
Returns the date representing the first day of the year.<P>
<HR>
<A NAME="wxdateisleapyear"></A>
<H3>wxDate::IsLeapYear</H3>
<P>
<B>bool</B> <B>IsLeapYear</B>() <B>const</B><P>
Returns TRUE if the year of this date is a leap year.<P>
<HR>
<A NAME="wxdateset"></A>
<H3>wxDate::Set</H3>
<P>
<B>wxDate&</B> <B>Set</B>()<P>
Sets the date to current system date, returning a reference to 'this'.<P>
<B>wxDate&</B> <B>Set</B>(<B>long</B><I> julian</I>)<P>
Sets the date to the given Julian date, returning a reference to 'this'.<P>
<B>wxDate&</B> <B>Set</B>(<B>int</B><I> month</I>, <B>int</B><I> day</I>, <B>int</B><I> year</I>)<P>
Sets the date to the given date, returning a reference to 'this'.<P>
<I>month</I> is a number from 1 to 12.<P>
<I>day</I> is a number from 1 to 31.<P>
<I>year</I> is a year, such as 1995, 2005.<P>
<HR>
<A NAME="wxdatesetformat"></A>
<H3>wxDate::SetFormat</H3>
<P>
<B>void</B> <B>SetFormat</B>(<B>int</B><I> format</I>)<P>
Sets the current format type.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>format</I><UL><UL>
-1 or one of:<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxDAY</B>
</TD>
<TD VALIGN=TOP>
Format day only.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxMONTH</B>
</TD>
<TD VALIGN=TOP>
Format month only.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxMDY</B>
</TD>
<TD VALIGN=TOP>
Format MONTH, DAY, YEAR.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxFULL</B>
</TD>
<TD VALIGN=TOP>
Format day, month and year in US style: DAYOFWEEK, MONTH, DAY, YEAR.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxEUROPEAN</B>
</TD>
<TD VALIGN=TOP>
Format day, month and year in European style: DAY, MONTH, YEAR.
</TD></TR>
</TABLE>
</UL></UL>
<P>
<HR>
<A NAME="wxdatesetoption"></A>
<H3>wxDate::SetOption</H3>
<P>
<B>int</B> <B>SetOption</B>(<B>int</B><I> option</I>, <B>const bool</B><I> enable=TRUE</I>)<P>
Enables or disables an option for formatting.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>option</I><UL><UL>
May be one of:<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxNO_CENTURY</B>
</TD>
<TD VALIGN=TOP>
The century is not formatted.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxDATE_ABBR</B>
</TD>
<TD VALIGN=TOP>
Month and day names are abbreviated to 3 characters when formatting.
</TD></TR>
</TABLE>
</UL></UL>
<P>
<HR>
<A NAME="wxdatewxstring"></A>
<H3>wxDate::operator wxString</H3>
<P>
<B></B> <B>operator wxString</B>()<P>
Conversion operator, to convert wxDate to wxString by calling FormatDate.<P>
<HR>
<A NAME="wxdateplus"></A>
<H3>wxDate::operator +</H3>
<P>
<B>wxDate</B> <B>operator +</B>(<B>long</B><I> i</I>)<P>
<B>wxDate</B> <B>operator +</B>(<B>int</B><I> i</I>)<P>
Adds an integer number of days to the date, returning a date.<P>
<HR>
<A NAME="wxdateminus"></A>
<H3>wxDate::operator -</H3>
<P>
<B>wxDate</B> <B>operator -</B>(<B>long</B><I> i</I>)<P>
<B>wxDate</B> <B>operator -</B>(<B>int</B><I> i</I>)<P>
Subtracts an integer number of days from the date, returning a date.<P>
<B>long</B> <B>operator -</B>(<B>const wxDate&</B><I> date</I>)<P>
Subtracts one date from another, return the number of intervening days.<P>
<HR>
<A NAME="wxdateplusequals"></A>
<H3>wxDate::operator +=</H3>
<P>
<B>wxDate&</B> <B>operator +=</B>(<B>long</B><I> i</I>)<P>
Postfix operator: adds an integer number of days to the date, returning
a reference to 'this' date.<P>
<HR>
<A NAME="wxdateminusequals"></A>
<H3>wxDate::operator -=</H3>
<P>
<B>wxDate&</B> <B>operator -=</B>(<B>long</B><I> i</I>)<P>
Postfix operator: subtracts an integer number of days from the date, returning
a reference to 'this' date.<P>
<HR>
<A NAME="wxdateplusplus"></A>
<H3>wxDate::operator ++</H3>
<P>
<B>wxDate&</B> <B>operator ++</B>()<P>
Increments the date (postfix or prefix).<P>
<HR>
<A NAME="wxdateminusminus"></A>
<H3>wxDate::operator --</H3>
<P>
<B>wxDate&</B> <B>operator --</B>()<P>
Decrements the date (postfix or prefix).<P>
<HR>
<A NAME="wxdatelessthan"></A>
<H3>wxDate::operator <</H3>
<P>
<B>friend bool</B> <B>operator <</B>(<B>const wxDate&</B><I> date1</I>, <B>const wxDate&</B><I> date2</I>)<P>
Function to compare two dates, returning TRUE if <I>date1</I> is earlier than <I>date2</I>.<P>
<HR>
<A NAME="wxdatelessthaneq"></A>
<H3>wxDate::operator <=</H3>
<P>
<B>friend bool</B> <B>operator <=</B>(<B>const wxDate&</B><I> date1</I>, <B>const wxDate&</B><I> date2</I>)<P>
Function to compare two dates, returning TRUE if <I>date1</I> is earlier than or equal to <I>date2</I>.<P>
<HR>
<A NAME="wxdategreaterthan"></A>
<H3>wxDate::operator ></H3>
<P>
<B>friend bool</B> <B>operator ></B>(<B>const wxDate&</B><I> date1</I>, <B>const wxDate&</B><I> date2</I>)<P>
Function to compare two dates, returning TRUE if <I>date1</I> is later than <I>date2</I>.<P>
<HR>
<A NAME="wxdategreaterthaneq"></A>
<H3>wxDate::operator >=</H3>
<P>
<B>friend bool</B> <B>operator >=</B>(<B>const wxDate&</B><I> date1</I>, <B>const wxDate&</B><I> date2</I>)<P>
Function to compare two dates, returning TRUE if <I>date1</I> is later than or equal to <I>date2</I>.<P>
<HR>
<A NAME="wxdateequals"></A>
<H3>wxDate::operator ==</H3>
<P>
<B>friend bool</B> <B>operator ==</B>(<B>const wxDate&</B><I> date1</I>, <B>const wxDate&</B><I> date2</I>)<P>
Function to compare two dates, returning TRUE if <I>date1</I> is equal to <I>date2</I>.<P>
<HR>
<A NAME="wxdatenotequals"></A>
<H3>wxDate::operator !=</H3>
<P>
<B>friend bool</B> <B>operator !=</B>(<B>const wxDate&</B><I> date1</I>, <B>const wxDate&</B><I> date2</I>)<P>
Function to compare two dates, returning TRUE if <I>date1</I> is not equal to <I>date2</I>.<P>
<HR>
<A NAME="wxdateinsert"></A>
<H3>wxDate::operator <<</H3>
<P>
<B>friend ostream&</B> <B>operator <<</B>(<B>ostream&</B><I> os</I>, <B>const wxDate&</B><I> date</I>)<P>
Function to output a wxDate to an ostream.<P>
</BODY></HTML>
|