X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3980000ca63a479b7b30ca93c07edbf12e4a51b7..034ad06337f97ffa3742fd8d9a8df2a4e9d5ed4a:/docs/latex/wx/datetime.tex?ds=inline diff --git a/docs/latex/wx/datetime.tex b/docs/latex/wx/datetime.tex index 57ecb54df6..6fc226c1d1 100644 --- a/docs/latex/wx/datetime.tex +++ b/docs/latex/wx/datetime.tex @@ -6,7 +6,7 @@ %% Created: 07.03.00 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% License: wxWidgets license +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxDateTime}}\label{wxdatetime} @@ -97,7 +97,7 @@ Likewise, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv\_WeekDay are the values in Finally, Inv\_Year is defined to be an invalid value for year parameter. \helpref{GetMonthName()}{wxdatetimegetmonthname} and -\helpref{GetWeekDayName}{wxdatetimegetweekdayname} functions use the followign +\helpref{GetWeekDayName}{wxdatetimegetweekdayname} functions use the following flags: \begin{verbatim} @@ -121,7 +121,7 @@ parameters is one of the following values: \end{verbatim} Date calculations often depend on the country and wxDateTime allows to set the -country whose conventions should be used using +country whose conventions should be used using \helpref{SetCountry}{wxdatetimesetcountry}. It takes one of the following values as parameter: @@ -148,7 +148,7 @@ values as parameter: Different parts of the world use different conventions for the week start. In some countries, the week starts on Sunday, while in others -- on Monday. The ISO standard doesn't address this issue, so we support both conventions in -the functions whose result depends on it (\helpref{GetWeekOfYear}{wxdatetimegetweekofyear} and +the functions whose result depends on it (\helpref{GetWeekOfYear}{wxdatetimegetweekofyear} and \helpref{GetWeekOfMonth}{wxdatetimegetweekofmonth}). The desired behvaiour may be specified by giving one of the following @@ -192,7 +192,7 @@ Please note that although several function accept an extra {\it Calendar} parameter, it is currently ignored as only the Gregorian calendar is supported. Future versions will support other calendars. -\pythonnote{These methods are standalone functions named +\pythonnote{These methods are standalone functions named {\tt wxDateTime\_} in wxPython.} \helpref{SetCountry}{wxdatetimesetcountry}\\ @@ -202,7 +202,7 @@ supported. Future versions will support other calendars. \helpref{ConvertYearToBC}{wxdatetimeconvertyeartobc}\\ \helpref{GetCurrentMonth}{wxdatetimegetcurrentmonth}\\ \helpref{IsLeapYear}{wxdatetimeisleapyear}\\ -\helpref{GetCentury}{wxdatetimegetcentury}\\ +\helpref{GetCentury}{wxdatetimegetcenturystatic}\\ \helpref{GetNumberOfDays}{wxdatetimegetnumberofdays}\\ \helpref{GetNumberOfDays}{wxdatetimegetnumberofdays}\\ \helpref{GetMonthName}{wxdatetimegetmonthname}\\ @@ -253,11 +253,12 @@ values were correct as constructors can not return an error code. \membersection{Accessors}\label{datetimeaccessors} Here are the trivial accessors. Other functions, which might have to perform -some more complicated calculations to find the answer are under the +some more complicated calculations to find the answer are under the \helpref{Calendar calculations}{datetimecalculations} section. \helpref{IsValid}{wxdatetimeisvalid}\\ \helpref{GetTicks}{wxdatetimegetticks}\\ +\helpref{GetCentury}{wxdatetimegetcentury}\\ \helpref{GetYear}{wxdatetimegetyear}\\ \helpref{GetMonth}{wxdatetimegetmonth}\\ \helpref{GetDay}{wxdatetimegetday}\\ @@ -318,32 +319,32 @@ defined to be equivalent to the second forms of these functions. These functions convert wxDateTime objects to and from text. The conversions to text are mostly trivial: you can either do it using the default -date and time representations for the current locale ( -\helpref{FormatDate}{wxdatetimeformatdate} and +date and time representations for the current locale ( +\helpref{FormatDate}{wxdatetimeformatdate} and \helpref{FormatTime}{wxdatetimeformattime}), using the international standard -representation defined by ISO 8601 ( -\helpref{FormatISODate}{wxdatetimeformatisodate} and +representation defined by ISO 8601 ( +\helpref{FormatISODate}{wxdatetimeformatisodate} and \helpref{FormatISOTime}{wxdatetimeformatisotime}) or by specifying any format at all and using \helpref{Format}{wxdatetimeformat} directly. The conversions from text are more interesting, as there are much more -possibilities to care about. The simplest cases can be taken care of with +possibilities to care about. The simplest cases can be taken care of with \helpref{ParseFormat}{wxdatetimeparseformat} which can parse any date in the given (rigid) format. \helpref{ParseRfc822Date}{wxdatetimeparserfc822date} is another function for parsing dates in predefined format -- the one of RFC 822 which (still...) defines the format of email messages on the Internet. This -format can not be described with {\tt strptime(3)}-like format strings used by +format can not be described with {\tt strptime(3)}-like format strings used by \helpref{Format}{wxdatetimeformat}, hence the need for a separate function. -But the most interesting functions are -\helpref{ParseTime}{wxdatetimeparsetime}, -\helpref{ParseDate}{wxdatetimeparsedate} and +But the most interesting functions are +\helpref{ParseTime}{wxdatetimeparsetime}, +\helpref{ParseDate}{wxdatetimeparsedate} and \helpref{ParseDateTime}{wxdatetimeparsedatetime}. They try to parse the date ans time (or only one of them) in `free' format, i.e. allow them to be specified in any of possible ways. These functions will usually be used to parse the (interactive) user input which is not bound to be in any predefined format. As an example, \helpref{ParseDateTime}{wxdatetimeparsedatetime} can -parse the strings such as {\tt "tomorrow"}, {\tt "March first"} and even +parse the strings such as {\tt "tomorrow"}, {\tt "March first"} and even {\tt "next Sunday"}. \helpref{ParseRfc822Date}{wxdatetimeparserfc822date}\\ @@ -406,10 +407,12 @@ provided. You can construct a wxDateTime object from a Please see the \helpref{time zone overview}{tdatetimezones} for more information about time zones. Normally, these functions should be rarely used. +\helpref{FromTimezone}{wxdatetimefromtimezone}\\ \helpref{ToTimezone}{wxdatetimetotimezone}\\ \helpref{MakeTimezone}{wxdatetimemaketimezone}\\ -\helpref{ToGMT}{wxdatetimetogmt}\\ -\helpref{MakeGMT}{wxdatetimemakegmt}\\ +\helpref{MakeFromTimezone}{wxdatetimemakefromtimezone}\\ +\helpref{ToUTC}{wxdatetimetoutc}\\ +\helpref{MakeUTC}{wxdatetimemakeutc}\\ \helpref{GetBeginDST}{wxdatetimegetbegindst}\\ \helpref{GetEndDST}{wxdatetimegetenddst}\\ \helpref{IsDST}{wxdatetimeisdst} @@ -489,9 +492,9 @@ Get the current year in given calendar (only Gregorian is currently supported). Get the current month in given calendar (only Gregorian is currently supported). -\membersection{wxDateTime::GetCentury}\label{wxdatetimegetcentury} +\membersection{wxDateTime::GetCentury}\label{wxdatetimegetcenturystatic} -\func{static int}{GetCentury}{\param{int }{year = Inv\_Year}} +\func{static int}{GetCentury}{\param{int }{year}} Get the current century, i.e. first two digits of the year, in given calendar (only Gregorian is currently supported). @@ -545,10 +548,21 @@ Returns the current time. \membersection{wxDateTime::GetTmNow}\label{wxdatetimegettmnow} -\func{static struct tm *}{GetTmNow}{\void} +\func{static struct tm *}{GetTmNow}{\param{struct tm *}{tm}} + +Returns the current time broken down, uses the buffer whose adress is +passed to the function via {\it tm} to store the result. + +\membersection{wxDateTime::GetTmNow} -Returns the current time broken down. +\func{static struct tm *}{GetTmNow}{\void} +Returns the current time broken down. Note that this function returns a +pointer to a static buffer that's reused by calls to this function and +certain C library functions (e.g. localtime). If there is any chance your +code might be used in a multi-threaded application, you really should use +the flavour of function \helpref{wxDateTime::GetTmNow}{wxdatetimegettmnow} +taking a parameter. \membersection{wxDateTime::GetWeekDayName}\label{wxdatetimegetweekdayname} @@ -601,7 +615,7 @@ Example: printf("Current time in Paris:\t%s\n", now.Format("%c", wxDateTime::CET).c_str()); \end{verbatim} -Note that this function is accurate up to second: +Note that this function is accurate up to second: \helpref{wxDateTime::UNow}{wxdatetimeunow} should be used for better precision (but it is less efficient and might not be available on all platforms). @@ -698,7 +712,7 @@ Same as \helpref{Set}{wxdatetimewxdatetimetime} \membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimedate} -\func{wxDateTime\&}{wxDateTime}{\param{wxDateTime\_t }{day}, \param{Month }{month = Inv\_Month}, \param{int}{ Inv\_Year}, +\func{wxDateTime\&}{wxDateTime}{\param{wxDateTime\_t }{day}, \param{Month }{month = Inv\_Month}, \param{int}{ Inv\_Year}, \param{wxDateTime\_t }{hour = 0}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}} Same as \helpref{Set}{wxdatetimesetdate} @@ -859,6 +873,13 @@ Returns the number of seconds since Jan 1, 1970. An assert failure will occur if the date is not in the range covered by {\tt time\_t} type. +\membersection{wxDateTime::GetCentury}\label{wxdatetimegetcentury} + +\constfunc{int}{GetCentury}{\param{const TimeZone\& }{tz = Local}} + +Returns the century of this date. + + \membersection{wxDateTime::GetYear}\label{wxdatetimegetyear} \constfunc{int}{GetYear}{\param{const TimeZone\& }{tz = Local}} @@ -932,10 +953,10 @@ the year is, according to international standards, the one containing Jan 4 or, equivalently, the first week which has Thursday in this year. Both of these definitions are the same as saying that the first week of the year must contain more than half of its days in this year. Accordingly, the week number will -always be in $1\ldots53$ range ($52$ for non leap years). +always be in $1\ldots53$ range ($52$ for non-leap years). The function depends on the \helpref{week start}{wxdatetime} convention -specified by the {\it flags} argument but its results for +specified by the {\it flags} argument but its results for \texttt{Sunday\_First} are not well-defined as the ISO definition quoted above applies to the weeks starting on Monday only. @@ -973,8 +994,8 @@ calculations make sense for it). \func{wxDateTime\&}{Set}{\param{unsigned long }{ddt}} -Sets the date from the date and time in -\urlref{DOS}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms\_docs/data/hc2vlu5i.html} +Sets the date from the date and time in +\urlref{DOS}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms\_docs/data/hc2vlu5i.html} format. @@ -982,8 +1003,8 @@ format. \constfunc{unsigned long}{GetAsDOS}{\void} -Returns the date and time in -\urlref{DOS}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms\_docs/data/hc2vlu5i.html} +Returns the date and time in +\urlref{DOS}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms\_docs/data/hc2vlu5i.html} format. %%%%%%%%%%%%%%%%%%%%%%%%%%% comparison %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1147,7 +1168,7 @@ free ways, you should use \helpref{ParseDateTime}{wxdatetimeparsedatetime} or \membersection{wxDateTime::ParseFormat}\label{wxdatetimeparseformat} -\func{const wxChar *}{ParseFormat}{\param{const wxChar *}{date}, \param{const wxChar *}{format = "\%c"}, \param{const wxDateTime\& }{dateDef = wxDefaultDateTime}} +\func{const wxChar *}{ParseFormat}{\param{const wxChar *}{date}, \param{const wxChar *}{format = wxDefaultDateTimeFormat}, \param{const wxDateTime\& }{dateDef = wxDefaultDateTime}} This function parses the string {\it date} according to the given {\it format}. The system {\tt strptime(3)} function is used whenever available, @@ -1181,8 +1202,7 @@ will accept anything that may be accepted and will only reject strings which can not be parsed in any way at all. Returns {\tt NULL} if the conversion failed, otherwise return the pointer to -the character which stopped the scan. This method is currently not -implemented, so always returns NULL. +the character which stopped the scan. \membersection{wxDateTime::ParseDate}\label{wxdatetimeparsedate} @@ -1190,7 +1210,7 @@ implemented, so always returns NULL. \func{const wxChar *}{ParseDate}{\param{const wxChar *}{date}} This function is like \helpref{ParseDateTime}{wxdatetimeparsedatetime}, but it -only allows the date to be specified. It is thus less flexible then +only allows the date to be specified. It is thus less flexible then \helpref{ParseDateTime}{wxdatetimeparsedatetime}, but also has less chances to misinterpret the user input. @@ -1211,7 +1231,7 @@ the character which stopped the scan. \membersection{wxDateTime::Format}\label{wxdatetimeformat} -\constfunc{wxString }{Format}{\param{const wxChar *}{format = "\%c"}, \param{const TimeZone\& }{tz = Local}} +\constfunc{wxString }{Format}{\param{const wxChar *}{format = wxDefaultDateTimeFormat}, \param{const TimeZone\& }{tz = Local}} This function does the same as the standard ANSI C {\tt strftime(3)} function. Please see its description for the meaning of {\it format} parameter. @@ -1273,7 +1293,7 @@ Returns the reference to the modified object itself. \constfunc{wxDateTime}{GetWeekDayInSameWeek}{\param{WeekDay }{weekday}, \param{WeekFlags}{flags = {\tt Monday\_First}}} -Returns the copy of this object to which +Returns the copy of this object to which \helpref{SetToWeekDayInSameWeek}{wxdatetimesettoweekdayinsameweek} was applied. @@ -1367,7 +1387,7 @@ given \arg{year} . The number should be in range $1\ldots53$. Note that the returned date may be in a different year than the one passed to this function because both the week $1$ and week $52$ or $53$ (for leap years) -contain days from different years. See +contain days from different years. See \helpref{GetWeekOfYear}{wxdatetimegetweekofyear} for the explanation of how the year weeks are counted. @@ -1461,6 +1481,16 @@ year 1 is Rata Die day 1. %%%%%%%%%%%%%%%%%%%%%%%%%%% timezone and DST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\membersection{wxDateTime::FromTimezone}\label{wxdatetimefromtimezone} + +\constfunc{wxDateTime}{FromTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = false}} + +Transform the date from the given time zone to the local one. If {\it noDST} is +{\tt true}, no DST adjustments will be made. + +Returns the date in the local time zone. + + \membersection{wxDateTime::ToTimezone}\label{wxdatetimetotimezone} \constfunc{wxDateTime}{ToTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = false}} @@ -1479,17 +1509,25 @@ Modifies the object in place to represent the date in another time zone. If {\it noDST} is {\tt true}, no DST adjustments will be made. -\membersection{wxDateTime::ToGMT}\label{wxdatetimetogmt} +\membersection{wxDateTime::MakeFromTimezone}\label{wxdatetimemakefromtimezone} + +\func{wxDateTime\&}{MakeFromTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = false}} + +Same as \helpref{FromTimezone}{wxdatetimefromtimezone} but modifies the object +in place. + + +\membersection{wxDateTime::ToUTC}\label{wxdatetimetoutc} -\constfunc{wxDateTime}{ToGMT}{\param{bool }{noDST = false}} +\constfunc{wxDateTime}{ToUTC}{\param{bool }{noDST = false}} This is the same as calling \helpref{ToTimezone}{wxdatetimetotimezone} with the argument {\tt GMT0}. -\membersection{wxDateTime::MakeGMT}\label{wxdatetimemakegmt} +\membersection{wxDateTime::MakeUTC}\label{wxdatetimemakeutc} -\func{wxDateTime\&}{MakeGMT}{\param{bool }{noDST = false}} +\func{wxDateTime\&}{MakeUTC}{\param{bool }{noDST = false}} This is the same as calling \helpref{MakeTimezone}{wxdatetimemaketimezone} with the argument {\tt GMT0}.