Date. More...

#include <rdate.h>

Collaboration diagram for RDate:
[legend]

Public Member Functions

 RDate (void)
 
 RDate (const RDate &src)
 
 RDate (char day, char month, int year, char hour=0, char minute=0, char second=0)
 
 RDate (const RString &date)
 
int Compare (const RDate &d) const
 
RDateoperator= (const RDate &date)
 
bool operator== (const RDate &d) const
 
bool operator!= (const RDate &d) const
 
bool operator< (const RDate &d) const
 
bool operator<= (const RDate &d) const
 
bool operator> (const RDate &d) const
 
bool operator>= (const RDate &d) const
 
char GetDay (void) const
 
char GetMonth (void) const
 
int GetYear (void) const
 
char GetHour (void) const
 
char GetMinute (void) const
 
char GetSecond (void) const
 
 operator double () const
 
 operator RString () const
 
RString ToString (void) const
 
void SetDate (char day, char month, int year, char hour=0, char minute=0, char second=0)
 
void SetDate (const RString &date)
 
void SetToday (void)
 
 ~RDate (void)
 

Static Public Member Functions

static RDate GetToday (void)
 

Static Public Attributes

static RDate Null
 

Private Attributes

int Year
 
char Month
 
char Day
 
char Hour
 
char Minute
 
char Second
 

Detailed Description

Date.

The RDate class provides a representation for a date.

#include <rdate.h>
using namespace R;
RDate Date(30,12,2005,12,12,11);
cout<<Date.ToString()<<endl;

Constructor & Destructor Documentation

RDate ( void  )

Construct a date. The current date is used.

RDate ( const RDate src)

Copy constructor.

RDate ( char  day,
char  month,
int  year,
char  hour = 0,
char  minute = 0,
char  second = 0 
)

Construct a date.

Parameters
dayDay.
monthMonth.
yearYear.
hourHour.
minuteMinute.
secondSecond.
RDate ( const RString date)

Construct a date. If string is null, then the current date is used.

Parameters
dateString representing a date in YYYY-MM-DD HH:MM:SS or YY-MM-DD HH:MM:SS.
~RDate ( void  )

Destruct the date.

Member Function Documentation

int Compare ( const RDate d) const

Lexically compares two dates and returns an integer less than, equal to, or greater than zero if this is less than, equal to, or greater than d.

Parameters
dDate to compare with.
See also
R::RContainer.
RDate& operator= ( const RDate date)

Assignment operator using another date.

bool operator== ( const RDate d) const

Equal operator.

bool operator!= ( const RDate d) const

Difference operator.

bool operator< ( const RDate d) const

Less operator.

bool operator<= ( const RDate d) const

Less or equal operator.

bool operator> ( const RDate d) const

Greather operator.

bool operator>= ( const RDate d) const

Greather or equal operator.

char GetDay ( void  ) const

Get the day of the date.

char GetMonth ( void  ) const

Get the month of the date.

int GetYear ( void  ) const

Get the year of the date.

char GetHour ( void  ) const

Get the hour of the date.

char GetMinute ( void  ) const

Get the minute of the date.

char GetSecond ( void  ) const

Get the second of the date.

operator double ( ) const

Get a double version of the date. In practice, it computes the number of seconds elapsed since the 01/01/000 at 00:00:00.

Returns
a number of seconds.
operator RString ( ) const

Get a string representring the date.

RString ToString ( void  ) const

Get a string representring the date.

void SetDate ( char  day,
char  month,
int  year,
char  hour = 0,
char  minute = 0,
char  second = 0 
)

Set the date.

Parameters
dayDay.
monthMonth.
yearYear.
hourHour.
minuteMinute.
secondSecond.
void SetDate ( const RString date)

Set the date. If string is null, then the current date is used.

Parameters
dateString representing a date in YYYY-MM-DD HH:MM:SS or YY-MM-DD HH:MM:SS.
void SetToday ( void  )

Set the date to the one given by the system.

static RDate GetToday ( void  )
static

Get the current date.

Field Documentation

int Year
private

Year

char Month
private

Month.

char Day
private

Day.

char Hour
private

Hour.

char Minute
private

Minute.

char Second
private

Second.

RDate Null
static

Represents a null date.