DateTime Class Reference

A representation of a calendar date and clock time. More...

#include <DateTime.h++>

Inheritance diagram for DateTime:

Inheritance graph
[legend]
Collaboration diagram for DateTime:

Collaboration graph
[legend]

List of all members.

Public Types

enum  Weekday {
  Invalid = 0, Monday, Tuesday, Wednesday,
  Thursday, Friday, Saturday, Sunday
}

Public Member Functions

 DateTime (time_s_t time) throw ()
 Construct a DateTime for the given system time.
 DateTime (time_ms_t time=0) throw ()
 Construct a DateTime for the given time (or the current time).
 DateTime (uint_t day, uint_t month, uint_t year, uint_t hour=0, uint_t minute=0, uint_t second=0, uint_t msec=0) throw ()
 Construct a DateTime with the given components.
 DateTime (const Date &date, const Time &time) throw ()
 Construct a DateTime from the given Date and Time.
 DateTime (const Date &date) throw ()
 DateTime (const Time &time) throw ()
 DateTime (const DateTime &other) throw ()
 Copy constructor.
virtual ~DateTime () throw ()
 Destructor.
DateTimenormalize () throw ()
 Normalize the DateTime.
 operator time_s_t () const throw ()
 Cast operator.
 operator time_ms_t () const throw ()
 Cast operator.
bool operator== (const DateTime &other) const throw ()
bool operator< (const DateTime &other) const throw ()
bool operator<= (const DateTime &other) const throw ()
bool operator!= (const DateTime &other) const throw ()
bool operator> (const DateTime &other) const throw ()
bool operator>= (const DateTime &other) const throw ()
DateTimeoperator= (time_s_t other) throw ()
DateTimeoperator= (time_ms_t other) throw ()
DateTimeoperator= (const DateTime &other) throw ()
void setTime (uint_t hour, uint_t minute, uint_t second=0, uint_t msec=0) throw ()
 Set the hour, minute, second, and millisecond components of the time.
void setDate (uint_t day, uint_t month, uint_t year) throw ()
 Set the day, month, and year components of the date.
DateTimesetDate (const Date &other) throw ()
DateTimesetTime (const Time &other) throw ()
DateTimeoperator+= (const TimeSpan &span) throw ()
DateTimeoperator-= (const TimeSpan &span) throw ()
void setMonth (uint_t month) throw ()
 Set the month component of the date.
void setDay (uint_t day) throw ()
 Set the day-of-month component of the date.
void setYear (uint_t year) throw ()
 Set the year component of the date.
uint_t getMonth () const throw ()
 Get the month component of the date.
uint_t getDay () const throw ()
 Get the day-of-month component of the date.
uint_t getYear () const throw ()
 Get the year component of the date.
Weekday getWeekday () const throw ()
 Get the weekday of the date.
uint_t getDayOfYear () const throw ()
 Get the day of the year.
uint_t getWeekOfYear () const throw ()
 Get the week number of the year, where weeks are defined as beginning on Monday (ISO standard).
bool isValid () const throw ()
 Test if the date is valid.
bool operator== (const Date &other) const throw ()
bool operator< (const Date &other) const throw ()
bool operator<= (const Date &other) const throw ()
bool operator!= (const Date &other) const throw ()
bool operator> (const Date &other) const throw ()
bool operator>= (const Date &other) const throw ()
void setHour (uint_t hour) throw ()
 Set the hour component of the time.
void setHour12 (uint_t hour, bool pm=false) throw ()
 Set the hour component of the time (12-hour clock).
void setMinute (uint_t minute) throw ()
 Set the minute component of the time.
void setSecond (uint_t second) throw ()
 Set the second component of the time.
void setMillisecond (uint_t msec) throw ()
 Set the millisecond component of the time.
uint_t getHour () const throw ()
 Get the hour component of the time.
uint_t getHour12 () const throw ()
 Get the hour component of the time (12-hour clock).
bool isPM () const throw ()
 Test if the hour is post meridiem.
bool isAM () const throw ()
 Test if the hour is ante meridiem.
uint_t getMinute () const throw ()
 Get the minute component of the time.
uint_t getSecond () const throw ()
 Get the second component of the time.
uint_t getMillisecond () const throw ()
 Get the millisecond component of the time.
bool operator== (const Time &other) const throw ()
bool operator< (const Time &other) const throw ()
bool operator<= (const Time &other) const throw ()
bool operator!= (const Time &other) const throw ()
bool operator> (const Time &other) const throw ()
bool operator>= (const Time &other) const throw ()

Static Public Member Functions

static bool isDSTActive () throw ()
 Test if Daylight Saving Time is in effect for the current local time.
static int getGMTOffset () throw ()
 Get the offset, in seconds, between local time and GMT.
static String getTimeZone () throw ()
 Get the name of the local time zone.
static bool isLeapYear (uint_t year) throw ()
 Test if a year is a leap year.

Static Public Attributes

static const uint_t JAN = 1
 The month of January.
static const uint_t FEB = 2
 The month of February.
static const uint_t MAR = 3
 The month of March.
static const uint_t APR = 4
 The month of April.
static const uint_t MAY = 5
 The month of May.
static const uint_t JUN = 6
 The month of June.
static const uint_t JUL = 7
 The month of July.
static const uint_t AUG = 8
 The month of August.
static const uint_t SEP = 9
 The month of September.
static const uint_t OCT = 10
 The month of October.
static const uint_t NOV = 11
 The month of November.
static const uint_t DEC = 12
 The month of December.

Protected Attributes

uint_t _year
uint_t _month
uint_t _day
Weekday _wday
uint_t _yday
int _wnum
uint_t _hour
uint_t _minute
uint_t _second
uint_t _msec


Detailed Description

A representation of a calendar date and clock time.

Author:
Mark Lindner

Member Enumeration Documentation

enum Weekday [inherited]

Enumerator:
Invalid 
Monday 
Tuesday 
Wednesday 
Thursday 
Friday 
Saturday 
Sunday 


Constructor & Destructor Documentation

DateTime ( time_s_t  time  )  throw ()

Construct a DateTime for the given system time.

DateTime ( time_ms_t  time = 0  )  throw ()

Construct a DateTime for the given time (or the current time).

DateTime ( uint_t  day,
uint_t  month,
uint_t  year,
uint_t  hour = 0,
uint_t  minute = 0,
uint_t  second = 0,
uint_t  msec = 0 
) throw ()

Construct a DateTime with the given components.

DateTime ( const Date date,
const Time time 
) throw ()

Construct a DateTime from the given Date and Time.

DateTime ( const Date date  )  throw ()

DateTime ( const Time time  )  throw ()

DateTime ( const DateTime other  )  throw ()

Copy constructor.

~DateTime (  )  throw () [virtual]

Destructor.


Member Function Documentation

uint_t getDay (  )  const throw () [inline, inherited]

Get the day-of-month component of the date.

uint_t getDayOfYear (  )  const throw () [inherited]

Get the day of the year.

int getGMTOffset (  )  throw () [static]

Get the offset, in seconds, between local time and GMT.

uint_t getHour (  )  const throw () [inline, inherited]

Get the hour component of the time.

uint_t getHour12 (  )  const throw () [inline, inherited]

Get the hour component of the time (12-hour clock).

uint_t getMillisecond (  )  const throw () [inline, inherited]

Get the millisecond component of the time.

uint_t getMinute (  )  const throw () [inline, inherited]

Get the minute component of the time.

uint_t getMonth (  )  const throw () [inline, inherited]

Get the month component of the date.

uint_t getSecond (  )  const throw () [inline, inherited]

Get the second component of the time.

String getTimeZone (  )  throw () [static]

Get the name of the local time zone.

Date::Weekday getWeekday (  )  const throw () [inherited]

Get the weekday of the date.

uint_t getWeekOfYear (  )  const throw () [inherited]

Get the week number of the year, where weeks are defined as beginning on Monday (ISO standard).

uint_t getYear (  )  const throw () [inline, inherited]

Get the year component of the date.

bool isAM (  )  const throw () [inline, inherited]

Test if the hour is ante meridiem.

bool isDSTActive (  )  throw () [static]

Test if Daylight Saving Time is in effect for the current local time.

bool isLeapYear ( uint_t  year  )  throw () [static, inherited]

Test if a year is a leap year.

bool isPM (  )  const throw () [inline, inherited]

Test if the hour is post meridiem.

bool isValid (  )  const throw () [inherited]

Test if the date is valid.

DateTime & normalize (  )  throw ()

Normalize the DateTime.

This method converts invalid dates into valid dates. For example, a date of "February 31, 2000" is normalized to "March 2, 2000".

operator time_ms_t (  )  const throw ()

Cast operator.

operator time_s_t (  )  const throw ()

Cast operator.

bool operator!= ( const Time other  )  const throw () [inline, inherited]

bool operator!= ( const Date other  )  const throw () [inline, inherited]

bool operator!= ( const DateTime other  )  const throw () [inline]

DateTime & operator+= ( const TimeSpan span  )  throw ()

DateTime & operator-= ( const TimeSpan span  )  throw ()

bool operator< ( const Time other  )  const throw () [inherited]

bool operator< ( const Date other  )  const throw () [inherited]

bool operator< ( const DateTime other  )  const throw ()

bool operator<= ( const Time other  )  const throw () [inherited]

bool operator<= ( const Date other  )  const throw () [inherited]

bool operator<= ( const DateTime other  )  const throw ()

DateTime & operator= ( const DateTime other  )  throw ()

DateTime & operator= ( time_ms_t  other  )  throw ()

DateTime & operator= ( time_s_t  other  )  throw ()

bool operator== ( const Time other  )  const throw () [inherited]

bool operator== ( const Date other  )  const throw () [inherited]

bool operator== ( const DateTime other  )  const throw ()

bool operator> ( const Time other  )  const throw () [inline, inherited]

bool operator> ( const Date other  )  const throw () [inline, inherited]

bool operator> ( const DateTime other  )  const throw () [inline]

bool operator>= ( const Time other  )  const throw () [inline, inherited]

bool operator>= ( const Date other  )  const throw () [inline, inherited]

bool operator>= ( const DateTime other  )  const throw () [inline]

DateTime & setDate ( const Date other  )  throw ()

void setDate ( uint_t  day,
uint_t  month,
uint_t  year 
) throw () [inline]

Set the day, month, and year components of the date.

Reimplemented from Date.

void setDay ( uint_t  day  )  throw () [inherited]

Set the day-of-month component of the date.

void setHour ( uint_t  hour  )  throw () [inherited]

Set the hour component of the time.

void setHour12 ( uint_t  hour,
bool  pm = false 
) throw () [inherited]

Set the hour component of the time (12-hour clock).

void setMillisecond ( uint_t  msec  )  throw () [inherited]

Set the millisecond component of the time.

void setMinute ( uint_t  minute  )  throw () [inherited]

Set the minute component of the time.

void setMonth ( uint_t  month  )  throw () [inherited]

Set the month component of the date.

void setSecond ( uint_t  second  )  throw () [inherited]

Set the second component of the time.

DateTime & setTime ( const Time other  )  throw ()

void setTime ( uint_t  hour,
uint_t  minute,
uint_t  second = 0,
uint_t  msec = 0 
) throw () [inline]

Set the hour, minute, second, and millisecond components of the time.

Reimplemented from Time.

void setYear ( uint_t  year  )  throw () [inherited]

Set the year component of the date.


Member Data Documentation

uint_t _day [protected, inherited]

uint_t _hour [protected, inherited]

uint_t _minute [protected, inherited]

uint_t _month [protected, inherited]

uint_t _msec [protected, inherited]

uint_t _second [protected, inherited]

Weekday _wday [mutable, protected, inherited]

int _wnum [mutable, protected, inherited]

uint_t _yday [mutable, protected, inherited]

uint_t _year [protected, inherited]

const uint_t APR = 4 [static, inherited]

The month of April.

const uint_t AUG = 8 [static, inherited]

The month of August.

const uint_t DEC = 12 [static, inherited]

The month of December.

const uint_t FEB = 2 [static, inherited]

The month of February.

const uint_t JAN = 1 [static, inherited]

The month of January.

const uint_t JUL = 7 [static, inherited]

The month of July.

const uint_t JUN = 6 [static, inherited]

The month of June.

const uint_t MAR = 3 [static, inherited]

The month of March.

const uint_t MAY = 5 [static, inherited]

The month of May.

const uint_t NOV = 11 [static, inherited]

The month of November.

const uint_t OCT = 10 [static, inherited]

The month of October.

const uint_t SEP = 9 [static, inherited]

The month of September.


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

Generated on Sat Apr 17 23:03:08 2010 for libcommonc++ by  doxygen 1.5.9