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 (const boost::gregorian::date &d)
 Constructor. More...
 
 Date (const boost::gregorian::greg_year &year, const boost::gregorian::greg_month &month, const boost::gregorian::greg_day &day)
 Constructor. More...
 
 Date (const te::dt::Date &rhs)
 Copy Constructor. More...
 
boost::gregorian::date & getDate ()
 It returns the internal boost date type. More...
 
const boost::gregorian::date & getDate () const
 It returns the internal boost date type. More...
 
DateTimeType getDateTimeType () const
 It returns the subtype of the date and time type. More...
 
const boost::gregorian::greg_day & getDay () const
 It returns the gregorian day - from 1 to 31. More...
 
const 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...
 
const 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...
 
Dateoperator= (const Date &date)
 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...
 

Static Public Member Functions

static Datenow ()
 

Protected Attributes

std::unique_ptr< DateImpl > m_dateImpl
 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 65 of file Date.h.

Constructor & Destructor Documentation

◆ Date() [1/4]

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

Empty constructor.

◆ Date() [2/4]

te::dt::Date::Date ( const boost::gregorian::greg_year &  year,
const boost::gregorian::greg_month &  month,
const 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].

◆ Date() [3/4]

te::dt::Date::Date ( const boost::gregorian::date &  d)

Constructor.

Parameters
dA date based on the Gregorian Calendar.

◆ Date() [4/4]

te::dt::Date::Date ( const te::dt::Date rhs)

Copy Constructor.

◆ ~Date()

virtual te::dt::Date::~Date ( )
virtual

Destructor.

Member Function Documentation

◆ clone()

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

It returns a clone of this object.

Returns
A clone of this object.

Implements te::dt::AbstractData.

◆ getDate() [1/2]

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

It returns the internal boost date type.

Returns
The internal boost date type.

◆ getDate() [2/2]

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

It returns the internal boost date type.

Returns
The internal boost date type.

Referenced by te::pgis::Internal2TimeStampTZ().

◆ getDateTimeType()

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. Returns an instance of this class initialized with the current date time

Implements te::dt::DateTime.

Definition at line 205 of file Date.h.

References te::dt::DATE.

◆ getDay()

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

It returns the gregorian day - from 1 to 31.

Returns
The gregorian day.

◆ getMonth()

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

It returns the gregorian month - from 1 to 12.

Returns
The gregorian month.

◆ getTypeCode()

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.

◆ getYear()

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

It returns the gregorian year.

Returns
The gregorian year.

◆ now()

static Date* te::dt::Date::now ( )
static

◆ operator!=()

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.

◆ operator-()

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.

◆ operator<()

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.

◆ operator=()

Date& te::dt::Date::operator= ( const Date date)

Operator =.

Parameters
rhsThe date to be assigned.
Returns
It returns the new value for the assigned object

◆ operator==()

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.

◆ operator>()

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.

◆ toString()

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

◆ m_dateImpl

std::unique_ptr<DateImpl> te::dt::Date::m_dateImpl
protected

Internal date information.

Definition at line 217 of file Date.h.


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