Ananas Library 0.9.5
aDateService Class Reference

#include <adateservice.h>

Inheritance diagram for aDateService:
AExtension

Public Slots

bool IsNull () const
 Returns TRUE if the date is null; otherwise returns FALSE. A null date is invalid.
.
 
bool IsValid () const
 Returns TRUE if this date is valid; otherwise returns FALSE. .
 
bool IsValid (int y, int m, int d)
 Returns TRUE if the specified date (year y, month m and day d) is valid; otherwise returns FALSE. .
 
int Year () const
 Returns the year (1752..8000) of this date. .
 
int Month () const
 Returns the month (January=1..December=12) of this date. .
 
int Day () const
 Returns the day of the month (1..31) of this date. .
 
int DayOfWeek () const
 Returns the weekday (Monday=1..Sunday=7) for this date. .
 
int DayOfYear () const
 Returns the day of the year (1..365) for this date. .
 
int DaysInMonth () const
 Returns the number of days in the month (28..31) for this date. .
 
int DaysInYear () const
 Returns the number of days in the year (365 or 366) for this date. .
 
int WeekNumber () const
 Returns the week number (1 to 53) for this date.
 
QString ToString (const QString &format=QString::null) const
 Returns the date as a string. The format parameter determines the format of the result string.
 
QDate ToDate () const
 
bool SetYMD (int y, int m, int d)
 Sets the date's year y, month m and day d.
 
aDateServiceAddDays (int ndays) const
 Returns a aDateService object containing a date ndays later than the date of this object (or earlier if ndays is negative). .
 
aDateServiceAddMonths (int nmonths) const
 Returns a aDateService object containing a date nmonths later than the date of this object (or earlier if nmonths is negative). .
 
aDateServiceAddYears (int nyears) const
 Returns a aDateService object containing a date nyears later than the date of this object (or earlier if nyears is negative). .
 
int DaysTo (const aDateService &target) const
 Returns the number of days from this date to target (which is negative if target is earlier than this date). .
 
int DaysTo (const QDate &target) const
 Returns the number of days from this date to target (which is negative if target is earlier than this date). .
 

Public Member Functions

 aDateService ()
 Constructor that create object aDateService for use in ananas script.
 
 aDateService (int y, int m, int d)
 Constructor that create object aDateService for use in ananas script. .
 
 aDateService (const aDateService &)
 Constructor that create object aDateService for use in ananas script. .
 
 aDateService (const QDate &)
 Constructor that create object aDateService for use in ananas script. .
 
 ~aDateService ()
 Destructor .
 
- Public Member Functions inherited from AExtension
 AExtension (const char *name=0)
 
virtual int init (aDatabase *dbo)
 

Protected Attributes

QDate * dateInstance
 

Additional Inherited Members

- Signals inherited from AExtension
void event (const QString &data)
 
- Public Attributes inherited from AExtension
aDatabasedb
 

Detailed Description

Constructor & Destructor Documentation

◆ aDateService() [1/4]

aDateService::aDateService ( )

Constructor that create object aDateService for use in ananas script.

Constructs current date object.

Referenced by AddDays(), AddMonths(), and AddYears().

◆ aDateService() [2/4]

aDateService::aDateService ( int y,
int m,
int d )

Constructor that create object aDateService for use in ananas script. .

◆ aDateService() [3/4]

aDateService::aDateService ( const aDateService & d)

Constructor that create object aDateService for use in ananas script. .

References Day(), Month(), and Year().

◆ aDateService() [4/4]

aDateService::aDateService ( const QDate & d)

Constructor that create object aDateService for use in ananas script. .

◆ ~aDateService()

aDateService::~aDateService ( )

Destructor .

Member Function Documentation

◆ AddDays

aDateService * aDateService::AddDays ( int ndays) const
slot

Returns a aDateService object containing a date ndays later than the date of this object (or earlier if ndays is negative). .

References aDateService(), Day(), Month(), and Year().

◆ AddMonths

aDateService * aDateService::AddMonths ( int nmonths) const
slot

Returns a aDateService object containing a date nmonths later than the date of this object (or earlier if nmonths is negative). .

References aDateService(), Day(), Month(), and Year().

◆ AddYears

aDateService * aDateService::AddYears ( int nyears) const
slot

Returns a aDateService object containing a date nyears later than the date of this object (or earlier if nyears is negative). .

References aDateService(), Day(), Month(), and Year().

◆ Day

int aDateService::Day ( ) const
slot

Returns the day of the month (1..31) of this date. .

Referenced by aDateService(), AddDays(), AddMonths(), AddYears(), DaysTo(), DaysTo(), and ToDate().

◆ DayOfWeek

int aDateService::DayOfWeek ( ) const
slot

Returns the weekday (Monday=1..Sunday=7) for this date. .

◆ DayOfYear

int aDateService::DayOfYear ( ) const
slot

Returns the day of the year (1..365) for this date. .

◆ DaysInMonth

int aDateService::DaysInMonth ( ) const
slot

Returns the number of days in the month (28..31) for this date. .

◆ DaysInYear

int aDateService::DaysInYear ( ) const
slot

Returns the number of days in the year (365 or 366) for this date. .

◆ DaysTo [1/2]

int aDateService::DaysTo ( const aDateService & target) const
slot

Returns the number of days from this date to target (which is negative if target is earlier than this date). .

Возвращает количество дней до указанной даты от даты, представленной объектом.

Возвращаемое значение может быть отрицательным, если указанная дата находится в прошлом по отношению к дате, представленной объектом.

References Day(), Month(), and Year().

◆ DaysTo [2/2]

int aDateService::DaysTo ( const QDate & target) const
slot

Returns the number of days from this date to target (which is negative if target is earlier than this date). .

Возвращает количество дней до указанной даты от даты, представленной объектом.

Возвращаемое значение может быть отрицательным, если указанная дата находится в прошлом по отношению к дате, представленной объектом.

References Day(), Month(), and Year().

◆ IsNull

bool aDateService::IsNull ( ) const
slot

Returns TRUE if the date is null; otherwise returns FALSE. A null date is invalid.
.

◆ IsValid [1/2]

bool aDateService::IsValid ( ) const
slot

Returns TRUE if this date is valid; otherwise returns FALSE. .

◆ IsValid [2/2]

bool aDateService::IsValid ( int y,
int m,
int d )
slot

Returns TRUE if the specified date (year y, month m and day d) is valid; otherwise returns FALSE. .

◆ Month

int aDateService::Month ( ) const
slot

Returns the month (January=1..December=12) of this date. .

Referenced by aDateService(), AddDays(), AddMonths(), AddYears(), DaysTo(), DaysTo(), and ToDate().

◆ SetYMD

bool aDateService::SetYMD ( int y,
int m,
int d )
slot

Sets the date's year y, month m and day d.

y must be in the range 1752..8000, m must be in the range 1..12, and d must be in the range 1..31. Warning: If y is in the range 0..99, it is interpreted as 1900..1999.

Returns
TRUE if the date is valid; otherwise returns FALSE.

◆ ToDate

QDate aDateService::ToDate ( ) const
slot

References Day(), Month(), and Year().

◆ ToString

QString aDateService::ToString ( const QString & format = QString::null) const
slot

Returns the date as a string. The format parameter determines the format of the result string.

These expressions may be used: d - the day as number without a leading zero (1-31) dd - the day as number with a leading zero (01-31) ddd - the abbreviated localized day name (e.g. 'Mon'..'Sun'). dddd - the long localized day name (e.g. 'Monday'..'Sunday'). M - the month as number without a leading zero (1-12) MM - the month as number with a leading zero (01-12) MMM - the abbreviated localized month name (e.g. 'Jan'..'Dec'). MMMM - the long localized month name (e.g. 'January'..'December'). yy - the year as two digit number (00-99). yyyy - the year as four digit number (1752-8000)

Example format strings (assuming that the Date is the 20th July 1969):

Format dd.MM.yyyy Result 20.07.1969 Format ddd MMMM d yy Result Sun July 20 69

◆ WeekNumber

int aDateService::WeekNumber ( ) const
slot

Returns the week number (1 to 53) for this date.

In accordance with ISO 8601, weeks start on Monday and the first Thursday of a year is always in week 1 of that year. Most years have 52 weeks, but some have 53.

◆ Year

int aDateService::Year ( ) const
slot

Returns the year (1752..8000) of this date. .

Referenced by aDateService(), AddDays(), AddMonths(), AddYears(), DaysTo(), DaysTo(), and ToDate().


The documentation for this class was generated from the following files: