wxWidgets/docs/latex/wx/date.tex

353 lines
9.9 KiB
TeX
Raw Normal View History

\section{\class{wxDate}}\label{wxdate}
A class for manipulating dates.
NOTE: this class should be
used with caution, since it is not fully tested. It may be replaced
with a new class in the near future.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxTime}{wxtime}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxDate::wxDate}\label{wxdateconstr}
\func{}{wxDate}{\void}
Default constructor.
\func{}{wxDate}{\param{const wxDate\&}{ date}}
Copy constructor.
\func{}{wxDate}{\param{int}{ month}, \param{int}{ day}, \param{int}{ year}}
Constructor taking month, day and year.
\func{}{wxDate}{\param{long}{ julian}}
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.
\func{}{wxDate}{\param{const wxString\& }{dateString}}
Constructor taking a string representing a date. This must be either the string TODAY, or of the
form {\tt MM/DD/YYYY} or {\tt MM-DD-YYYY}. For example:
\begin{verbatim}
wxDate date("11/26/1966");
\end{verbatim}
\wxheading{Parameters}
\docparam{date}{Date to copy.}
\docparam{month}{Month: a number between 1 and 12.}
\docparam{day}{Day: a number between 1 and 31.}
\docparam{year}{Year, such as 1995, 2005.}
\membersection{wxDate::\destruct{wxDate}}
\func{void}{\destruct{wxDate}}{\void}
Destructor.
\membersection{wxDate::AddMonths}\label{wxdateaddmonths}
\func{wxDate\&}{AddMonths}{\param{int}{ months=1}}
Adds the given number of months to the date, returning a reference to `this'.
\membersection{wxDate::AddWeeks}\label{wxdateaddweeks}
\func{wxDate\&}{AddWeeks}{\param{int}{ weeks=1}}
Adds the given number of weeks to the date, returning a reference to `this'.
\membersection{wxDate::AddYears}\label{wxdateaddyears}
\func{wxDate\&}{AddYears}{\param{int}{ years=1}}
Adds the given number of months to the date, returning a reference to `this'.
\membersection{wxDate::FormatDate}\label{wxdateformatdate}
\constfunc{wxString}{FormatDate}{\param{int}{ type=-1}}
Formats the date according to {\it type} if not -1, or according
to the current display type if -1.
\wxheading{Parameters}
\docparam{type}{-1 or one of:
\begin{twocollist}\itemsep=0pt
\twocolitem{wxDAY}{Format day only.}
\twocolitem{wxMONTH}{Format month only.}
\twocolitem{wxMDY}{Format MONTH, DAY, YEAR.}
\twocolitem{wxFULL}{Format day, month and year in US style: DAYOFWEEK, MONTH, DAY, YEAR.}
\twocolitem{wxEUROPEAN}{Format day, month and year in European style: DAY, MONTH, YEAR.}
\end{twocollist}}
\membersection{wxDate::GetDay}\label{wxdategetday}
\constfunc{int}{GetDay}{\void}
Returns the numeric day (in the range 1 to 31).
\membersection{wxDate::GetDayOfWeek}\label{wxdategetdayofweek}
\constfunc{int}{GetDayOfWeek}{\void}
Returns the integer day of the week (in the range 1 to 7).
\membersection{wxDate::GetDayOfWeekName}\label{wxdategetdayofweekname}
\constfunc{wxString}{GetDayOfWeekName}{\void}
Returns the name of the day of week.
\membersection{wxDate::GetDayOfYear}\label{wxdategetdayofyear}
\constfunc{long}{GetDayOfYear}{\void}
Returns the day of the year (from 1 to 365).
\membersection{wxDate::GetDaysInMonth}\label{wxdategetdaysinmonth}
\constfunc{int}{GetDaysInMonth}{\void}
Returns the number of days in the month (in the range 1 to 31).
\membersection{wxDate::GetFirstDayOfMonth}\label{wxdategetfirstdayofmonth}
\constfunc{int}{GetFirstDayOfMonth}{\void}
Returns the day of week that is first in the month (in the range 1 to 7).
\membersection{wxDate::GetJulianDate}\label{wxdategetjuliandate}
\constfunc{long}{GetJulianDate}{\void}
Returns the Julian date.
\membersection{wxDate::GetMonth}\label{wxdategetmonth}
\constfunc{int}{GetMonth}{\void}
Returns the month number (in the range 1 to 12).
\membersection{wxDate::GetMonthEnd}
\func{wxDate}{GetMonthEnd}{\void}
Returns the date representing the last day of the month.
\membersection{wxDate::GetMonthName}\label{wxdategetmonthname}
\constfunc{wxString}{GetMonthName}{\void}
Returns the name of the month. Do not delete the returned storage.
\membersection{wxDate::GetMonthStart}\label{wxdategetmonthstart}
\constfunc{wxDate}{GetMonthStart}{\void}
Returns the date representing the first day of the month.
\membersection{wxDate::GetWeekOfMonth}\label{wxdategetweekofmonth}
\constfunc{int}{GetWeekOfMonth}{\void}
Returns the week of month (in the range 1 to 6).
\membersection{wxDate::GetWeekOfYear}\label{wxdategetweekofyear}
\constfunc{int}{GetWeekOfYear}{\void}
Returns the week of year (in the range 1 to 52).
\membersection{wxDate::GetYear}\label{wxdategetyear}
\constfunc{int}{GetYear}{\void}
Returns the year as an integer (such as `1995').
\membersection{wxDate::GetYearEnd}\label{wxdategetyearend}
\constfunc{wxDate}{GetYearEnd}{\void}
Returns the date representing the last day of the year.
\membersection{wxDate::GetYearStart}\label{wxdategetyearstart}
\constfunc{wxDate}{GetYearStart}{\void}
Returns the date representing the first day of the year.
\membersection{wxDate::IsLeapYear}\label{wxdateisleapyear}
\constfunc{bool}{IsLeapYear}{\void}
Returns TRUE if the year of this date is a leap year.
\membersection{wxDate::Set}\label{wxdateset}
\func{wxDate\&}{Set}{\void}
Sets the date to current system date, returning a reference to `this'.
\func{wxDate\&}{Set}{\param{long}{ julian}}
Sets the date to the given Julian date, returning a reference to `this'.
\func{wxDate\&}{Set}{\param{int}{ month}, \param{int}{ day}, \param{int}{ year}}
Sets the date to the given date, returning a reference to `this'.
{\it month} is a number from 1 to 12.
{\it day} is a number from 1 to 31.
{\it year} is a year, such as 1995, 2005.
\membersection{wxDate::SetFormat}\label{wxdatesetformat}
\func{void}{SetFormat}{\param{int}{ format}}
Sets the current format type.
\wxheading{Parameters}
\docparam{format}{-1 or one of:
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxDAY}}{Format day only.}
\twocolitem{{\bf wxMONTH}}{Format month only.}
\twocolitem{{\bf wxMDY}}{Format MONTH, DAY, YEAR.}
\twocolitem{{\bf wxFULL}}{Format day, month and year in US style: DAYOFWEEK, MONTH, DAY, YEAR.}
\twocolitem{{\bf wxEUROPEAN}}{Format day, month and year in European style: DAY, MONTH, YEAR.}
\end{twocollist}}
\membersection{wxDate::SetOption}\label{wxdatesetoption}
\func{int}{SetOption}{\param{int}{ option}, \param{const bool}{ enable=TRUE}}
Enables or disables an option for formatting.
\wxheading{Parameters}
\docparam{option}{May be one of:
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxNO\_CENTURY}}{The century is not formatted.}
\twocolitem{{\bf wxDATE\_ABBR}}{Month and day names are abbreviated to 3 characters when formatting.}
\end{twocollist}}
\membersection{wxDate::operator wxString}\label{wxdatewxstring}
\func{}{operator wxString}{\void}
Conversion operator, to convert wxDate to wxString by calling FormatDate.
\membersection{wxDate::operator $+$}\label{wxdateplus}
\func{wxDate}{operator $+$}{\param{long}{ i}}
\func{wxDate}{operator $+$}{\param{int}{ i}}
Adds an integer number of days to the date, returning a date.
\membersection{wxDate::operator $-$}\label{wxdateminus}
\func{wxDate}{operator $-$}{\param{long}{ i}}
\func{wxDate}{operator $-$}{\param{int}{ i}}
Subtracts an integer number of days from the date, returning a date.
\func{long}{operator $-$}{\param{const wxDate\&}{ date}}
Subtracts one date from another, return the number of intervening days.
\membersection{wxDate::operator $+=$}\label{wxdateplusequals}
\func{wxDate\&}{operator $+=$}{\param{long}{ i}}
Postfix operator: adds an integer number of days to the date, returning
a reference to `this' date.
\membersection{wxDate::operator $-=$}\label{wxdateminusequals}
\func{wxDate\&}{operator $-=$}{\param{long}{ i}}
Postfix operator: subtracts an integer number of days from the date, returning
a reference to `this' date.
\membersection{wxDate::operator $++$}\label{wxdateplusplus}
\func{wxDate\&}{operator $++$}{\void}
Increments the date (postfix or prefix).
\membersection{wxDate::operator $--$}\label{wxdateminusminus}
\func{wxDate\&}{operator $--$}{\void}
Decrements the date (postfix or prefix).
\membersection{wxDate::operator $<$}\label{wxdatelessthan}
\func{friend bool}{operator $<$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}}
Function to compare two dates, returning TRUE if {\it date1} is earlier than {\it date2}.
\membersection{wxDate::operator $<=$}\label{wxdatelessthaneq}
\func{friend bool}{operator $<=$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}}
Function to compare two dates, returning TRUE if {\it date1} is earlier than or equal to {\it date2}.
\membersection{wxDate::operator $>$}\label{wxdategreaterthan}
\func{friend bool}{operator $>$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}}
Function to compare two dates, returning TRUE if {\it date1} is later than {\it date2}.
\membersection{wxDate::operator $>=$}\label{wxdategreaterthaneq}
\func{friend bool}{operator $>=$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}}
Function to compare two dates, returning TRUE if {\it date1} is later than or equal to {\it date2}.
\membersection{wxDate::operator $==$}\label{wxdateequals}
\func{friend bool}{operator $==$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}}
Function to compare two dates, returning TRUE if {\it date1} is equal to {\it date2}.
\membersection{wxDate::operator $!=$}\label{wxdatenotequals}
\func{friend bool}{operator $!=$}{\param{const wxDate\&}{ date1}, \param{const wxDate\&}{ date2}}
Function to compare two dates, returning TRUE if {\it date1} is not equal to {\it date2}.
\membersection{wxDate::operator \cinsert}\label{wxdateinsert}
\func{friend ostream\&}{operator \cinsert}{\param{ostream\&}{ os}, \param{const wxDate\&}{ date}}
Function to output a wxDate to an ostream.