Talos::Date Class Reference

Class Date. More...

#include <Date.hxx>

List of all members.

Public Member Functions

 Date ()
 Default constructor.
 Date (const Date &date)
 Copy constructor.
 Date (string date)
 Copy constructor.
 Date (int yyyymmdd)
 Constructor.
 Date (int yyyy, int mm, int dd=1, int hh=0, int mn=0, double sc=0)
 Constructor.
Dateoperator= (const Date &)
 Assignment operator.
Dateoperator= (string date)
 Assignment operator.
void SetDate (string date)
 Sets the date.
void SetDate (int yyyymmdd)
 Sets the date.
void SetDate (int yyyy, int mm, int dd=1, int hh=0, int mn=0, double sc=0)
 Sets the date.
bool LeapYear (int year) const
 Is a given year a leap year?
bool LeapYear () const
 Is the current year a leap year?
int GetDate () const
 Returns the date in format YYYYMMDD.
string GetDate (const string &format) const
 Returns the date in a given format.
template<class T>
void GetDate (const string &format, T &date) const
 Returns the date in a given format.
int GetYear () const
 Returns the year.
int GetMonth () const
 Returns the month.
int GetDay () const
 Returns the day.
int GetHour () const
 Returns the hour.
int GetMinutes () const
 Returns the minutes.
double GetSeconds () const
 Returns the seconds.
void AddYears (int nb_yy)
 Adds years to the current date.
void AddMonths (int nb_mm)
 Adds months to the current date.
void AddDays (int nb_dd)
 Adds days to the current date.
void AddHours (int nb_hh)
 Adds hours to the current date.
void AddMinutes (int nb_mn)
 Adds minutes to the current date.
void AddSeconds (double nb_sc)
 Adds seconds to the current date.
void SetYear (int yyyy)
 Sets the year.
void SetMonth (int mm)
 Sets the month.
void SetDay (int dd)
 Sets the day.
void SetHour (int hh)
 Sets the hour.
void SetMinutes (int mn)
 Sets the minutes.
void SetSeconds (double sc)
 Sets the seconds.
int GetOrdinalDay () const
 Returns the ordinal number of the day in the year (between 1 and 366).
int GetDayNumber () const
 Returns the number of the day in the year (between 0 and 365).
int GetNumberOfDays () const
 Returns the number of days in the year before the current day.
int GetDaysFrom (Date date) const
 Returns the number of days from a given date.
double GetSecondsFrom (Date date) const
 Returns the number of seconds from a given date.
int GetNumberOfHours () const
 Returns the number of hours in the year before the current date.
int GetNumberOfMinutes () const
 Returns the number of minutes in the year before the current date.
double GetNumberOfSeconds () const
 Returns the number of seconds in the year before the current date.
int GetWeekDay () const
 Returns the week day.


Detailed Description

Class Date.


Constructor & Destructor Documentation

Talos::Date::Date ( const Date date  ) 

Copy constructor.

Parameters:
date date to be copied.

Talos::Date::Date ( string  date  ) 

Copy constructor.

Parameters:
date date in format YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHMM or YYYYMMDDHHMMSS, with each item (YYYY, MM, DD, etc.) possibly delimited with any character(s).

Talos::Date::Date ( int  yyyymmdd  ) 

Constructor.

Parameters:
yyyymmdd date in format YYYYMMDD.

Talos::Date::Date ( int  yyyy,
int  mm,
int  dd = 1,
int  hh = 0,
int  mn = 0,
double  sc = 0 
)

Constructor.

Parameters:
yyyy year.
mm month.
dd day.
hh hour.
mn minutes.
sc seconds.


Member Function Documentation

Date & Talos::Date::operator= ( const Date date  ) 

Assignment operator.

Parameters:
date date to be copied.

Date & Talos::Date::operator= ( string  date  ) 

Assignment operator.

Parameters:
date date in format YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHMM or YYYYMMDDHHMMSS, with each item (YYYY, MM, DD, etc.) possibly delimited with any character(s).

void Talos::Date::SetDate ( string  date  ) 

Sets the date.

Parameters:
date date in format YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHMM or YYYYMMDDHHMMSS, with each item (YYYY, MM, DD, etc.) possibly delimited with any character(s).

void Talos::Date::SetDate ( int  yyyymmdd  ) 

Sets the date.

Parameters:
yyyymmdd date in format YYYYMMDD.

void Talos::Date::SetDate ( int  yyyy,
int  mm,
int  dd = 1,
int  hh = 0,
int  mn = 0,
double  sc = 0 
)

Sets the date.

Parameters:
yyyy year.
mm month.
dd day.
hh hour.
mn minutes.
sc seconds.

bool Talos::Date::LeapYear ( int  year  )  const

Is a given year a leap year?

Parameters:
year year.
Returns:
true if the year 'year' is a leap year, false otherwise.

bool Talos::Date::LeapYear (  )  const

Is the current year a leap year?

Returns:
true if the current year is a leap year, false otherwise.

int Talos::Date::GetDate (  )  const

Returns the date in format YYYYMMDD.

Returns:
The date in format YYYYMMDD.

string Talos::Date::GetDate ( const string &  format  )  const

Returns the date in a given format.

'format' defines the format of the output. Special sequences are y, m, d, h, i, s for the year, the month, the day, the hour, the minutes and the seconds respectively.

Parameters:
format format.
Returns:
The date in format 'format'.

template<class T>
void Talos::Date::GetDate ( const string &  format,
T &  date 
) const

Returns the date in a given format.

'format' defines the format of the output. Special sequences are y, m, d, h, i, s for the year, the month, the day, the hour, the minutes and the seconds respectively.

Parameters:
format format.
date (output) the date in format 'format'.

int Talos::Date::GetYear (  )  const

Returns the year.

Returns:
The year.

int Talos::Date::GetMonth (  )  const

Returns the month.

Returns:
The month.

int Talos::Date::GetDay (  )  const

Returns the day.

Returns:
The day.

int Talos::Date::GetHour (  )  const

Returns the hour.

Returns:
The hour.

int Talos::Date::GetMinutes (  )  const

Returns the minutes.

Returns:
The minutes.

double Talos::Date::GetSeconds (  )  const

Returns the seconds.

Returns:
The seconds.

void Talos::Date::AddYears ( int  nb_yy  ) 

Adds years to the current date.

Parameters:
nb_yy number of years.

void Talos::Date::AddMonths ( int  nb_mm  ) 

Adds months to the current date.

Parameters:
nb_mm number of months.

void Talos::Date::AddDays ( int  nb_dd  ) 

Adds days to the current date.

Parameters:
nb_dd number of days.

void Talos::Date::AddHours ( int  nb_hh  ) 

Adds hours to the current date.

Parameters:
nb_hh number of hours.

void Talos::Date::AddMinutes ( int  nb_mn  ) 

Adds minutes to the current date.

Parameters:
nb_mn number of minutes.

void Talos::Date::AddSeconds ( double  nb_sc  ) 

Adds seconds to the current date.

Parameters:
nb_sc number of seconds.

void Talos::Date::SetYear ( int  yyyy  ) 

Sets the year.

Parameters:
yyyy the year.

void Talos::Date::SetMonth ( int  mm  ) 

Sets the month.

Parameters:
mm the month.

void Talos::Date::SetDay ( int  dd  ) 

Sets the day.

Parameters:
dd the day.

void Talos::Date::SetHour ( int  hh  ) 

Sets the hour.

Parameters:
hh the hour.

void Talos::Date::SetMinutes ( int  mn  ) 

Sets the minutes.

Parameters:
mn minutes.

void Talos::Date::SetSeconds ( double  sc  ) 

Sets the seconds.

Parameters:
sc seconds.

int Talos::Date::GetOrdinalDay (  )  const

Returns the ordinal number of the day in the year (between 1 and 366).

Returns:
The ordinal number of the day in the year (between 1 and 366).
Note:
The ordinal day is often but incorrectly refered to as 'Julian' day.

int Talos::Date::GetDayNumber (  )  const

Returns the number of the day in the year (between 0 and 365).

Returns:
The number of the day in the year (between 0 and 365).

int Talos::Date::GetNumberOfDays (  )  const

Returns the number of days in the year before the current day.

Returns:
The number of days in the year before the current day. (0 for the 1st of January).

int Talos::Date::GetDaysFrom ( Date  date  )  const

Returns the number of days from a given date.

Parameters:
date the reference date.
Returns:
The number of days between 'date' and the current date (positive if the current date is greater than 'date').

double Talos::Date::GetSecondsFrom ( Date  date  )  const

Returns the number of seconds from a given date.

Parameters:
date the reference date.
Returns:
The number of seconds between 'date' and the current date (positive if the current date is greater than 'date').

int Talos::Date::GetNumberOfHours (  )  const

Returns the number of hours in the year before the current date.

Returns:
The number of hours in the year before the current date.

int Talos::Date::GetNumberOfMinutes (  )  const

Returns the number of minutes in the year before the current date.

Returns:
The number of minutes in the year before the current date.

double Talos::Date::GetNumberOfSeconds (  )  const

Returns the number of seconds in the year before the current date.

Returns:
The number of seconds in the year before the current date.

int Talos::Date::GetWeekDay (  )  const

Returns the week day.

Week days are refered as follows:

0 is Monday
1 is Tuesday
2 is Wednesday
3 is Thursday
4 is Friday
5 is Saturday
6 is Sunday
Returns:
The week day number.


The documentation for this class was generated from the following files:
Generated on Mon Nov 17 18:20:41 2008 for Talos by  doxygen 1.5.1