Date. More...
#include <rdate.h>
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 |
RDate & | operator= (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.
Constructor & Destructor Documentation
RDate | ( | void | ) |
Construct a date. The current date is used.
RDate | ( | char | day, |
char | month, | ||
int | year, | ||
char | hour = 0 , |
||
char | minute = 0 , |
||
char | second = 0 |
||
) |
Construct a date.
- Parameters
-
day Day. month Month. year Year. hour Hour. minute Minute. second Second.
Construct a date. If string is null, then the current date is used.
- Parameters
-
date String 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
-
d Date to compare with.
- See also
- R::RContainer.
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
-
day Day. month Month. year Year. hour Hour. minute Minute. second Second.
void SetDate | ( | const RString & | date | ) |
Set the date. If string is null, then the current date is used.
- Parameters
-
date String 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 |
Get the current date.
Field Documentation
|
private |
Year
|
private |
Month.
|
private |
Day.
|
private |
Hour.
|
private |
Minute.
|
private |
Second.
|
static |
Represents a null date.