te::dt::Date Class Reference

A base class for date data types. More...

#include <Date.h>

Inheritance diagram for te::dt::Date:
te::dt::DateTimeInstant te::dt::DateTime te::dt::AbstractData

Public Member Functions

AbstractDataclone () const
 It returns a clone of this object. More...
 
 Date ()
 Empty constructor. More...
 
 Date (boost::gregorian::greg_year year, boost::gregorian::greg_month month, boost::gregorian::greg_day day)
 Constructor. More...
 
 Date (const boost::gregorian::date &d)
 Constructor. More...
 
const boost::gregorian::date & getDate () const
 It returns the internal boost date type. More...
 
boost::gregorian::date & getDate ()
 It returns the internal boost date type. More...
 
DateTimeType getDateTimeType () const
 It returns the subtype of the date and time type. More...
 
boost::gregorian::greg_day getDay () const
 It returns the gregorian day - from 1 to 31. More...
 
boost::gregorian::greg_month getMonth () const
 It returns the gregorian month - from 1 to 12. More...
 
int getTypeCode () const
 It returns the data type code associated to date and time values: DATETIME_TYPE. More...
 
boost::gregorian::greg_year getYear () const
 It returns the gregorian year. More...
 
bool operator!= (const DateTime &rhs) const
 Operator !=. More...
 
long operator- (const Date &rhs) const
 Operator -. More...
 
bool operator< (const DateTime &rhs) const
 Operator <. More...
 
bool operator== (const DateTime &rhs) const
 Operator ==. More...
 
bool operator> (const DateTime &rhs) const
 Operator > More...
 
std::string toString () const
 It returns the date in the ISO textual format (YYYYMMDD). More...
 
virtual ~Date ()
 Destructor. More...
 

Protected Attributes

boost::gregorian::date m_date
 Internal date information. More...
 

Detailed Description

A base class for date data types.

A class to represent dates based on the Gregorian Calendar. Internally, it uses boost datetime library to represent gregorian date, by using the data type boost::gregorian::date. For more information see the date representation defined in ISO 8601:2004 specification.

See also
DateTime, DateDuration, DatePeriod, TimeDuration, TimeInstant, TimeInstantTZ, TimePeriod, TimePeriodTZ

Definition at line 53 of file Date.h.

Constructor & Destructor Documentation

te::dt::Date::Date ( )

Empty constructor.

te::dt::Date::Date ( boost::gregorian::greg_year  year,
boost::gregorian::greg_month  month,
boost::gregorian::greg_day  day 
)

Constructor.

Parameters
yearA gregorian year in the range: [1400, 9999].
monthA gregorian month in the range: [1, 12].
dayA gregorian day in the range: [1,31].
te::dt::Date::Date ( const boost::gregorian::date &  d)

Constructor.

Parameters
dA date based on the Gregorian Calendar.
virtual te::dt::Date::~Date ( )
virtual

Destructor.

Member Function Documentation

AbstractData* te::dt::Date::clone ( ) const
virtual

It returns a clone of this object.

Returns
A clone of this object.

Implements te::dt::AbstractData.

const boost::gregorian::date& te::dt::Date::getDate ( ) const
inline

It returns the internal boost date type.

Returns
The internal boost date type.

Definition at line 83 of file Date.h.

boost::gregorian::date& te::dt::Date::getDate ( )
inline

It returns the internal boost date type.

Returns
The internal boost date type.

Definition at line 90 of file Date.h.

DateTimeType te::dt::Date::getDateTimeType ( ) const
inlinevirtual

It returns the subtype of the date and time type.

Returns
The subtype of the date and time type.

Implements te::dt::DateTime.

Definition at line 179 of file Date.h.

References te::dt::DATE.

boost::gregorian::greg_day te::dt::Date::getDay ( ) const
inline

It returns the gregorian day - from 1 to 31.

Returns
The gregorian day.

Definition at line 97 of file Date.h.

boost::gregorian::greg_month te::dt::Date::getMonth ( ) const
inline

It returns the gregorian month - from 1 to 12.

Returns
The gregorian month.

Definition at line 104 of file Date.h.

int te::dt::DateTime::getTypeCode ( ) const
inlinevirtualinherited

It returns the data type code associated to date and time values: DATETIME_TYPE.

Returns
The data type code associated to the date and time values: DATETIME_TYPE.

Implements te::dt::AbstractData.

Definition at line 103 of file DateTime.h.

References te::dt::DATETIME_TYPE.

boost::gregorian::greg_year te::dt::Date::getYear ( ) const
inline

It returns the gregorian year.

Returns
The gregorian year.

Definition at line 111 of file Date.h.

bool te::dt::Date::operator!= ( const DateTime rhs) const
virtual

Operator !=.

Parameters
rhsThe date to be compared.
Returns
It returns true if the two dates are not equal. Otherwise, it returns false.

Implements te::dt::DateTime.

long te::dt::Date::operator- ( const Date rhs) const

Operator -.

Parameters
rhsThe right side datetime.
Returns
It returns the number of the days between two dates.
bool te::dt::Date::operator< ( const DateTime rhs) const
virtual

Operator <.

Parameters
rhsThe right side date to be compared.
Returns
It returns true if the right side date is greater than the lefth side one. Otherwise, it returns false.

Implements te::dt::DateTime.

bool te::dt::Date::operator== ( const DateTime rhs) const
virtual

Operator ==.

Parameters
rhsThe date to be compared.
Returns
It returns true if the two dates are equal. Otherwise, it returns false.

Implements te::dt::DateTime.

bool te::dt::Date::operator> ( const DateTime rhs) const
virtual

Operator >

Parameters
rhsThe right side date to be compared.
Returns
It returns true if the right side date is less than the lefth side one. Otherwise, it returns false.

Implements te::dt::DateTime.

std::string te::dt::Date::toString ( ) const
virtual

It returns the date in the ISO textual format (YYYYMMDD).

Returns
The date in the ISO textual format (YYYYMMDD).

Implements te::dt::AbstractData.

Member Data Documentation

boost::gregorian::date te::dt::Date::m_date
protected

Internal date information.

Definition at line 188 of file Date.h.


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