Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

O3DBIDate Class Reference

#include <O3DBIDate.h>

Inheritance diagram for O3DBIDate:

Inheritance graph
[legend]
Collaboration diagram for O3DBIDate:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 O3DBIDate ()
 O3DBIDate (int year, int month, int day, int hour, int minute, int second)
 O3DBIDate (const tm &t)
 O3DBIDate (time_t time)
 O3DBIDate (unsigned long ulJulianDay)
 O3DBIDate (const O3DBIDate &other)
virtual ~O3DBIDate ()
O3DBIDateoperator= (const O3DBIDate &other)
O3DBIDateoperator= (const tm &t)
O3DBIDateoperator= (time_t time)
bool operator== (const O3DBIDate &other) const
bool operator!= (const O3DBIDate &other) const
bool operator>= (const O3DBIDate &other) const
bool operator> (const O3DBIDate &other) const
bool operator< (const O3DBIDate &other) const
bool operator<= (const O3DBIDate &other) const
TO3DBIEra GetEra (void) const
bool IsLeapYear (void) const
unsigned short GetDayOfWeek (void) const
int GetDayOfYear (void) const
int GetCalendarWeek (void) const
long GetJulianDay (void) const
TO3DBIString GetAsString (PC_TCHAR pchFormat=NULL) const
virtual TO3DBIString ToString (void) const

Detailed Description

This class represents an Oracle DATE datatype, used to store date and time information. The valid date range is from January 1, 4712 BCE to December 31, 9999 CE.

Definition at line 52 of file O3DBIDate.h.


Constructor & Destructor Documentation

O3DBIDate::O3DBIDate  ) 
 

The default constructor. Initializes the date to 1899-12-30 00:00:00.

Definition at line 42 of file O3DBIDate.cpp.

O3DBIDate::O3DBIDate int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

An initialization constructor.

Parameters:
year is the year, which must be in the range between -4712 and 9999.
month is the month, which must be in the range between 1 and 12.
day is the day, which must be in the range between 1 and 31.
hour is the hour, which must be in the range between 0 and 23.
minute is the minute, which must be in the range between 0 and 59.
second is the second, which must be in the range between 0 and 59.
Exceptions:
O3DBIException - if the passed date and/or time values are not representing a valid date or time.

Definition at line 52 of file O3DBIDate.cpp.

O3DBIDate::O3DBIDate const tm &  t  ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

An initialization constructor.

Parameters:
t is a const reference to a tm time structure, which is a standard type of the runtime library.

Definition at line 73 of file O3DBIDate.cpp.

O3DBIDate::O3DBIDate time_t  time  ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

An initialization constructor.

Parameters:
time is a value of type time_t, which is a standard type of the runtime library.

Definition at line 78 of file O3DBIDate.cpp.

O3DBIDate::O3DBIDate unsigned long  ulJulianDay  ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

An initialization constructor.

Parameters:
ulJulianDay is a julian day number.
See also:
O3DBIDate::GetJulianDay

Definition at line 83 of file O3DBIDate.cpp.

O3DBIDate::O3DBIDate const O3DBIDate other  ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

A copy constructor.

Parameters:
other is a const reference to another O3DBIDate object.

Definition at line 120 of file O3DBIDate.cpp.

O3DBIDate::~O3DBIDate  )  [virtual]
 

The virtual destructor.

Definition at line 125 of file O3DBIDate.cpp.


Member Function Documentation

TO3DBIString O3DBIDate::GetAsString PC_TCHAR  pchFormat = NULL  )  const
 

Call this member function to get a formatted date/time string from an O3DBIDate object.

Parameters:
pchFormat is a pointer to a zero-terminated format string. Can be NULL: in this case a default format is used and the produced string contains exactly 26 characters. The default for pchFormat is NULL.
Returns:
A TO3DBIString object containing the date/time string.
Formatting codes
The format argument can consist of one or more formatting codes, which are listed below:
  • %a - Abbreviated weekday name
  • %A - Full weekday name
  • %b - Abbreviated month name
  • %B - Full month name
  • %c - Date and time representation appropriate for locale
  • %d - Day of month as decimal number (01 – 31)
  • %e - The era (BC or BCE)
  • %H - Hour in 24-hour format (00 – 23)
  • %I - Hour in 12-hour format (01 – 12)
  • %j - Day of year as decimal number (001 – 366)
  • %m - Month as decimal number (01 – 12)
  • %M - Minute as decimal number (00 – 59)
  • %p - Current locale's A.M./P.M. indicator for 12-hour clock
  • %S - Second as decimal number (00 – 59)
  • %U - Week of year as decimal number, with Sunday as first day of week (00 – 53)
  • %w - Weekday as decimal number (0 – 6; Sunday is 0)
  • %W - Week of year as decimal number, with Monday as first day of week (00 – 53)
  • %x - Date representation for current locale
  • %X - Time representation for current locale
  • %y - Year without century, as decimal number (00 – 99)
  • %Y - Year with century, as decimal number
  • %z - Time-zone name; no characters if time zone is unknown
  • %Z - Time-zone abbreviation; no characters if time zone is unknown
  • %% - The percent sign
See C Run-Time Library documentation for more information about formatting codes!

Bug:
If the year value is less than 0, Y or y will not produce a correct formatted year-string.

Definition at line 446 of file O3DBIDate.cpp.

References GetDayOfWeek(), GetDayOfYear(), and TO3DBIString.

Referenced by ToString().

int O3DBIDate::GetCalendarWeek void   )  const
 

Returns the week of the year that includes the date of the O3DBIDate object.

Returns:
An integer ranging from 1 to 53.

Definition at line 395 of file O3DBIDate.cpp.

References GetDayOfWeek(), and GetDayOfYear().

unsigned short O3DBIDate::GetDayOfWeek void   )  const
 

Returns the ordinal for the day of the week.

Returns:
An unsigned short ranging from 0 (Sunday) to 6 (Saturday).

Definition at line 375 of file O3DBIDate.cpp.

References GetJulianDay().

Referenced by GetAsString(), and GetCalendarWeek().

int O3DBIDate::GetDayOfYear void   )  const
 

Returns the ordinal for the day of the year.

Returns:
An integer ranging from 1 to 365 (366 if year is a leap year).

Definition at line 380 of file O3DBIDate.cpp.

References IsLeapYear().

Referenced by GetAsString(), and GetCalendarWeek().

TO3DBIEra O3DBIDate::GetEra void   )  const
 

This member function returns the era of the O3DBIDate object.

Returns:
A value of the enumeration O3DBI::EEra, which can be BCE (beyond common era) or CE (common era).

long O3DBIDate::GetJulianDay void   )  const
 

Returns the julian day number that is equal to the date of the O3DBIDate object. The Julian day number system was invented by the astronomer John W. F. Herschel. The numbering starts with 0, which is equal to the date 4712-01-01 BCE.

Returns:
A signed long containing the julian day.

Definition at line 418 of file O3DBIDate.cpp.

Referenced by GetDayOfWeek().

bool O3DBIDate::IsLeapYear void   )  const
 

Determines whether the year of the O3DBIDate object is a leap year.

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

Definition at line 272 of file O3DBIDate.cpp.

Referenced by GetDayOfYear().

bool O3DBIDate::operator!= const O3DBIDate other  )  const
 

A comparison operator not-equal.

Parameters:
other is a const reference to another O3DBIDate object.

Definition at line 176 of file O3DBIDate.cpp.

bool O3DBIDate::operator< const O3DBIDate other  )  const
 

A comparison operator less-than.

Parameters:
other is a const reference to another O3DBIDate object.

Definition at line 225 of file O3DBIDate.cpp.

References _value.

bool O3DBIDate::operator<= const O3DBIDate other  )  const
 

A comparison operator less- or equal-than.

Parameters:
other is a const reference to another O3DBIDate object.

Definition at line 252 of file O3DBIDate.cpp.

References _value.

O3DBIDate & O3DBIDate::operator= time_t  time  ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

An assignment operator.

Parameters:
time is a value of type time_t, which is a standard type of the runtime library.

Definition at line 155 of file O3DBIDate.cpp.

O3DBIDate & O3DBIDate::operator= const tm &  t  ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

An assignment operator.

Parameters:
t is a const reference to a tm time structure, which is a standard type of the runtime library.

Definition at line 144 of file O3DBIDate.cpp.

O3DBIDate & O3DBIDate::operator= const O3DBIDate other  ) 
 

An assignment operator.

Parameters:
other is a const reference to another O3DBIDate object.

Definition at line 133 of file O3DBIDate.cpp.

References _value.

bool O3DBIDate::operator== const O3DBIDate other  )  const
 

A comparison operator for equality. Two O3DBIDate objects are equal, if they are representing exactly the same date and time.

Parameters:
other is a const reference to another O3DBIDate object.

Definition at line 166 of file O3DBIDate.cpp.

References _value.

bool O3DBIDate::operator> const O3DBIDate other  )  const
 

A comparison operator greater-than.

Parameters:
other is a const reference to another O3DBIDate object.

Definition at line 198 of file O3DBIDate.cpp.

References _value.

bool O3DBIDate::operator>= const O3DBIDate other  )  const
 

A comparison operator greater- or equal-than.

Parameters:
other is a const reference to another O3DBIDate object.

Definition at line 181 of file O3DBIDate.cpp.

References _value.

TO3DBIString O3DBIDate::ToString void   )  const [virtual]
 

This member function returns a string that "textually represents" this object.

Returns:
A TO3DBIString object containing the string.

Reimplemented from O3DBIObject.

Reimplemented in O3DBITimestamp.

Definition at line 479 of file O3DBIDate.cpp.

References GetAsString(), and TO3DBIString.


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


SourceForge.net Logo Generated on Sun Jan 23 11:36:45 2005 for Oracle Object Oriented Database Interface (O3DBI) by  doxygen 1.3.9.1