/////////////////////////////////////////////////////////////////////////////
// Name: datetime.h
-// Purpose: documentation for wxDateTime class
+// Purpose: interface of wxDateTime
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
@library{wxbase}
@category{data}
- @seealso
- @ref overview_wxdatetimeoverview "Date classes overview", wxTimeSpan,
+ @see @ref overview_wxdatetimeoverview "Date classes overview", wxTimeSpan,
wxDateSpan, wxCalendarCtrl
*/
class wxDateTime
Adds the given date span to this object.
*/
wxDateTime Add(const wxDateSpan& diff);
- wxDateTime Add(const wxDateSpan& diff);
+ const wxDateTime& Add(const wxDateSpan& diff);
wxDateTime operator+=(const wxDateSpan& diff);
//@}
static int ConvertYearToBC(int year);
/**
- These functions carry out arithmetics on the wxDateTime
+ These functions carry out arithmetics() on the wxDateTime
objects. As explained in the overview, either wxTimeSpan or wxDateSpan may be
added to wxDateTime, hence all functions are overloaded to accept both
arguments.
@see ParseFormat()
*/
wxString Format(const wxChar* format = wxDefaultDateTimeFormat,
- const TimeZone& tz = Local);
+ const TimeZone& tz = Local) const;
/**
Identical to calling Format() with @c "%x"
argument (which means 'preferred date representation for the current locale').
*/
- wxString FormatDate();
+ wxString FormatDate() const;
/**
Returns the combined date-time representation in the ISO 8601 format
@see FormatISODate(), FormatISOTime(),
ParseISOCombined()
*/
- wxString FormatISOCombined(char sep = 'T');
+ wxString FormatISOCombined(char sep = 'T') const;
/**
This function returns the date representation in the ISO 8601 format
(YYYY-MM-DD).
*/
- wxString FormatISODate();
+ wxString FormatISODate() const;
/**
This function returns the time representation in the ISO 8601 format
(HH:MM:SS).
*/
- wxString FormatISOTime();
+ wxString FormatISOTime() const;
/**
Identical to calling Format() with @c "%X"
argument (which means 'preferred time representation for the current locale').
*/
- wxString FormatTime();
+ wxString FormatTime() const;
/**
Transform the date from the given time zone to the local one. If @a noDST is
Returns the date in the local time zone.
*/
wxDateTime FromTimezone(const TimeZone& tz,
- bool noDST = false);
+ bool noDST = false) const;
/**
Returns the translations of the strings @c AM and @c PM used for time
DOS
format.
*/
- unsigned long GetAsDOS();
+ unsigned long GetAsDOS() const;
/**
Get the beginning of DST for the given country in the given year (current one
/**
Returns the century of this date.
*/
- int GetCentury(const TimeZone& tz = Local);
+ int GetCentury(const TimeZone& tz = Local) const;
/**
Returns the current default country. The default country is used for DST
/**
Returns the object having the same date component as this one but time of
00:00:00.
- This function is new since wxWidgets version 2.8.2
+
+ @wxsince{2.8.2}
@see ResetTime()
*/
- wxDateTime GetDateOnly();
+ wxDateTime GetDateOnly() const;
/**
Returns the day in the given timezone (local one by default).
*/
- wxDateTime_t GetDay(const TimeZone& tz = Local);
+ wxDateTime_t GetDay(const TimeZone& tz = Local) const;
/**
Returns the day of the year (in 1...366 range) in the given timezone
(local one by default).
*/
- wxDateTime_t GetDayOfYear(const TimeZone& tz = Local);
+ wxDateTime_t GetDayOfYear(const TimeZone& tz = Local) const;
/**
Returns the end of DST for the given country in the given year (current one by
/**
Returns the hour in the given timezone (local one by default).
*/
- wxDateTime_t GetHour(const TimeZone& tz = Local);
+ wxDateTime_t GetHour(const TimeZone& tz = Local) const;
/**
Synonym for GetJulianDayNumber().
*/
- double GetJDN();
+ double GetJDN() const;
/**
Returns the @ref setjdn() JDN corresponding to this date. Beware
@see GetModifiedJulianDayNumber()
*/
- double GetJulianDayNumber();
+ double GetJulianDayNumber() const;
/**
Returns the copy of this object to which
SetToLastMonthDay() was applied.
*/
wxDateTime GetLastMonthDay(Month month = Inv_Month,
- int year = Inv_Year);
+ int year = Inv_Year) const;
/**
Returns the copy of this object to which
/**
Synonym for GetModifiedJulianDayNumber().
*/
- double GetMJD();
+ double GetMJD() const;
/**
Returns the milliseconds in the given timezone (local one by default).
*/
- wxDateTime_t GetMillisecond(const TimeZone& tz = Local);
+ wxDateTime_t GetMillisecond(const TimeZone& tz = Local) const;
/**
Returns the minute in the given timezone (local one by default).
*/
- wxDateTime_t GetMinute(const TimeZone& tz = Local);
+ wxDateTime_t GetMinute(const TimeZone& tz = Local) const;
/**
Returns the @e Modified Julian Day Number (MJD) which is, by definition,
MJDs correspond to midnights of the dates in the Gregorian calendar and not th
noons like JDN. The MJD 0 is Nov 17, 1858.
*/
- double GetModifiedJulianDayNumber();
+ double GetModifiedJulianDayNumber() const;
/**
Returns the month in the given timezone (local one by default).
*/
- Month GetMonth(const TimeZone& tz = Local);
+ Month GetMonth(const TimeZone& tz = Local) const;
/**
Gets the full (default) or abbreviated (specify @c Name_Abbr name of the
Returns the copy of this object to which
SetToNextWeekDay() was applied.
*/
- wxDateTime GetNextWeekDay(WeekDay weekday);
+ wxDateTime GetNextWeekDay(WeekDay weekday) const;
//@{
/**
Returns the copy of this object to which
SetToPrevWeekDay() was applied.
*/
- wxDateTime GetPrevWeekDay(WeekDay weekday);
+ wxDateTime GetPrevWeekDay(WeekDay weekday) const;
/**
Return the @e Rata Die number of this date.
relative to a base date of December 31 of the year 0. Thus January 1 of the
year 1 is Rata Die day 1.
*/
- double GetRataDie();
+ double GetRataDie() const;
/**
Returns the seconds in the given timezone (local one by default).
*/
- wxDateTime_t GetSecond(const TimeZone& tz = Local);
+ wxDateTime_t GetSecond(const TimeZone& tz = Local) const;
/**
Returns the number of seconds since Jan 1, 1970. An assert failure will occur
if the date is not in the range covered by @c time_t type.
*/
- time_t GetTicks();
+ time_t GetTicks() const;
/**
Returns the current time.
/**
Returns broken down representation of the date and time.
*/
- Tm GetTm(const TimeZone& tz = Local);
+ Tm GetTm(const TimeZone& tz = Local) const;
/**
Returns the current time broken down. Note that this function returns a
*/
wxDateTime GetWeekDay(WeekDay weekday, int n = 1,
Month month = Inv_Month,
- int year = Inv_Year);
+ int year = Inv_Year) const;
/**
Returns the copy of this object to which
applied.
*/
wxDateTime GetWeekDayInSameWeek(WeekDay weekday,
- WeekFlags flags = Monday_First);
+ WeekFlags flags = Monday_First) const;
/**
Gets the full (default) or abbreviated (specify @c Name_Abbr name of the
@ref overview_wxdatetime "week start" conventions.
*/
wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First,
- const TimeZone& tz = Local);
+ const TimeZone& tz = Local) const;
/**
Returns the number of the week of the year this date is in. The first week of
applies to the weeks starting on Monday only.
*/
wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First,
- const TimeZone& tz = Local);
+ const TimeZone& tz = Local) const;
/**
Returns the year in the given timezone (local one by default).
*/
- int GetYear(const TimeZone& tz = Local);
+ int GetYear(const TimeZone& tz = Local) const;
/**
Returns the copy of this object to which
SetToYearDay() was applied.
*/
- wxDateTime GetYearDay(wxDateTime_t yday);
+ wxDateTime GetYearDay(wxDateTime_t yday) const;
/**
Returns @true if IsStrictlyBetween()
@see IsStrictlyBetween()
*/
- bool IsBetween(const wxDateTime& t1, const wxDateTime& t2);
+ bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const;
/**
Returns @true if the DST is applied for this date in the given country.
*/
- int IsDST(Country country = Country_Default);
+ int IsDST(Country country = Country_Default) const;
/**
Returns @true if DST was used n the given year (the current one by
/**
Returns @true if this date precedes the given one.
*/
- bool IsEarlierThan(const wxDateTime& datetime);
+ bool IsEarlierThan(const wxDateTime& datetime) const;
/**
Returns @true if the two dates are strictly identical.
*/
- bool IsEqualTo(const wxDateTime& datetime);
+ bool IsEqualTo(const wxDateTime& datetime) const;
/**
Returns @true if the date is equal to another one up to the given time
interval, i.e. if the absolute difference between the two dates is less than
this interval.
*/
- bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts);
+ bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const;
/**
Returns @true if the given date is later than the date of adoption of the
Gregorian calendar in the given country (and hence the Gregorian calendar
calculations make sense for it).
*/
- bool IsGregorianDate(GregorianAdoption country = Gr_Standard);
+ bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const;
/**
Returns @true if this date is later than the given one.
*/
- bool IsLaterThan(const wxDateTime& datetime);
+ bool IsLaterThan(const wxDateTime& datetime) const;
/**
Returns @true if the @a year is a leap one in the specified calendar.
/**
Returns @true if the date is the same without comparing the time parts.
*/
- bool IsSameDate(const wxDateTime& dt);
+ bool IsSameDate(const wxDateTime& dt) const;
/**
Returns @true if the time is the same (although dates may differ).
*/
- bool IsSameTime(const wxDateTime& dt);
+ bool IsSameTime(const wxDateTime& dt) const;
/**
Returns @true if this date lies strictly between the two others,
@see IsBetween()
*/
bool IsStrictlyBetween(const wxDateTime& t1,
- const wxDateTime& t2);
+ const wxDateTime& t2) const;
/**
Returns @true if the object represents a valid time moment.
*/
- bool IsValid();
+ bool IsValid() const;
/**
This function returns @true if the specified (or default) country is one
/**
Returns @true is this day is not a holiday in the given country.
*/
- bool IsWorkDay(Country country = Country_Default);
+ bool IsWorkDay(Country country = Country_Default) const;
/**
Same as FromTimezone() but modifies the object
Subtracts another date from this one and returns the difference between them
as wxTimeSpan.
*/
- wxTimeSpan Subtract(const wxDateTime& dt);
+ wxTimeSpan Subtract(const wxDateTime& dt) const;
/**
Please see the @ref overview_tdatetimezones "time zone overview" for more
DST adjustments will be made.
Returns the date in the new time zone.
*/
- wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false);
+ wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const;
/**
This is the same as calling ToTimezone() with
the argument @c GMT0.
*/
- wxDateTime ToUTC(bool noDST = false);
+ wxDateTime ToUTC(bool noDST = false) const;
/**
Returns the object corresponding to the midnight of the current day (i.e. the
};
+
/**
@class wxDateTimeWorkDays
@wxheader{datetime.h}
};
+
/**
@class wxDateSpan
@wxheader{datetime.h}
@library{wxbase}
@category{data}
- @seealso
- @ref overview_wxdatetimeoverview "Date classes overview", wxDateTime
+ @see @ref overview_wxdatetimeoverview "Date classes overview", wxDateTime
*/
class wxDateSpan
{
second and third ones modify this object in place.
*/
wxDateSpan Add(const wxDateSpan& other);
- wxDateSpan Add(const wxDateSpan& other);
+ const wxDateSpan& Add(const wxDateSpan& other);
wxDateSpan operator+=(const wxDateSpan& other);
//@}
@see GetTotalDays()
*/
- int GetDays();
+ int GetDays() const;
/**
Returns the number of the months (not counting the years) in this date span.
*/
- int GetMonths();
+ int GetMonths() const;
/**
Returns the combined number of days in this date span, counting both weeks and
@see GetWeeks(), GetDays()
*/
- int GetTotalDays();
+ int GetTotalDays() const;
/**
Returns the number of weeks in this date span.
@see GetTotalDays()
*/
- int GetWeeks();
+ int GetWeeks() const;
/**
Returns the number of years in this date span.
*/
- int GetYears();
+ int GetYears() const;
/**
Returns a date span object corresponding to one month.
object in place.
*/
wxDateSpan Multiply(int factor);
- wxDateSpan Multiply(int factor);
+ const wxDateSpan& Multiply(int factor);
wxDateSpan operator*=(int factor);
//@}
@see Neg()
*/
- wxDateSpan Negate();
+ wxDateSpan Negate() const;
/**
Sets the number of days (without modifying any other components) in this date
object, the second and third ones modify this object in place.
*/
wxDateSpan Subtract(const wxDateSpan& other);
- wxDateSpan Subtract(const wxDateSpan& other);
+ const wxDateSpan& Subtract(const wxDateSpan& other);
wxDateSpan operator+=(const wxDateSpan& other);
//@}
/**
Returns @true if this date span is different from the other one.
*/
- bool operator!=(wxDateSpan& other);
+ bool operator!=(wxDateSpan& other) const;
/**
Returns @true if this date span is equal to the other one. Two date spans
are considered equal if and only if they have the same number of years and
months and the same total number of days (counting both days and weeks).
*/
- bool operator==(wxDateSpan& other);
+ bool operator==(wxDateSpan& other) const;
};
+
/**
@class wxTimeSpan
@wxheader{datetime.h}
@library{wxbase}
@category{data}
- @seealso
- @ref overview_wxdatetimeoverview "Date classes overview", wxDateTime
+ @see @ref overview_wxdatetimeoverview "Date classes overview", wxDateTime
*/
class wxTimeSpan
{
Returns the absolute value of the timespan: does not modify the
object.
*/
- wxTimeSpan Abs();
+ wxTimeSpan Abs() const;
/**
GetSeconds()
Returns the sum of two timespans.
*/
wxTimeSpan Add(const wxTimeSpan& diff);
- wxTimeSpan Add(const wxTimeSpan& diff);
+ const wxTimeSpan& Add(const wxTimeSpan& diff);
wxTimeSpan operator+=(const wxTimeSpan& diff);
//@}
/**
Returns the difference in number of days.
*/
- int GetDays();
+ int GetDays() const;
/**
Returns the difference in number of hours.
*/
- int GetHours();
+ int GetHours() const;
/**
Returns the difference in number of milliseconds.
*/
- wxLongLong GetMilliseconds();
+ wxLongLong GetMilliseconds() const;
/**
Returns the difference in number of minutes.
*/
- int GetMinutes();
+ int GetMinutes() const;
/**
Returns the difference in number of seconds.
*/
- wxLongLong GetSeconds();
+ wxLongLong GetSeconds() const;
/**
Returns the internal representation of timespan.
*/
- wxLongLong GetValue();
+ wxLongLong GetValue() const;
/**
Returns the difference in number of weeks.
*/
- int GetWeeks();
+ int GetWeeks() const;
/**
Returns the timespan for one hour.
/**
Returns @true if two timespans are equal.
*/
- bool IsEqualTo(const wxTimeSpan& ts);
+ bool IsEqualTo(const wxTimeSpan& ts) const;
/**
Compares two timespans: works with the absolute values, i.e. -2
hours is longer than 1 hour. Also, it will return @false if
the timespans are equal in absolute value.
*/
- bool IsLongerThan(const wxTimeSpan& ts);
+ bool IsLongerThan(const wxTimeSpan& ts) const;
/**
Returns @true if the timespan is negative.
*/
- bool IsNegative();
+ bool IsNegative() const;
/**
Returns @true if the timespan is empty.
*/
- bool IsNull();
+ bool IsNull() const;
/**
Returns @true if the timespan is positive.
*/
- bool IsPositive();
+ bool IsPositive() const;
/**
Compares two timespans: works with the absolute values, i.e. 1
hour is shorter than -2 hours. Also, it will return @false if
the timespans are equal in absolute value.
*/
- bool IsShorterThan(const wxTimeSpan& ts);
+ bool IsShorterThan(const wxTimeSpan& ts) const;
/**
Returns the timespan for one millisecond.
Multiplies timespan by a scalar.
*/
wxTimeSpan Multiply(int n);
- wxTimeSpan Multiply(int n);
+ const wxTimeSpan& Multiply(int n);
wxTimeSpan operator*=(int n);
//@}
/**
Returns timespan with inverted sign.
*/
- wxTimeSpan Negate();
+ wxTimeSpan Negate() const;
/**
Add()
Returns the difference of two timespans.
*/
wxTimeSpan Subtract(const wxTimeSpan& diff);
- wxTimeSpan Subtract(const wxTimeSpan& diff);
+ const wxTimeSpan& Subtract(const wxTimeSpan& diff);
wxTimeSpan operator-=(const wxTimeSpan& diff);
//@}
};
+
/**
@class wxDateTimeHolidayAuthority
@wxheader{datetime.h}
public:
};
+