Index

DKDate

Purpose:

DKDate is a class to hold the date data type. When represented as a string, the default format of DKDate is yyyy-mm-dd, as required by the majority of datastores. DKDDO supports DKDate objects; that is, it can send an attribute with DKDate type, in and out of a datastore.

Class summary:

 class DKDate
 {
 public:
 
  typedef enum Month (January=1, February, March, April,
                      May, June, July, August, September, 
                      October, November, December);
 
  DKDate(Month nMonth, int nDay, int nYear);
  DKDate(int nDay, Month nMonth, int nYear); 
  DkDate(int nYear, int mm, int nDay); 
  DKDate(const DKDate& date); 
  DKDate();
  DKDate(const char* dateString);
 
  virtual DKDate();
 
  dkString asString(const char* pFormat) const;
 
  int      getYear()   const;
  int      getMonth()  const;
  int      getDay()    const;
     
  static  dkDate     fromString(const char* dateString);
  friend ostream& operator << (ostream& outstream,
                               const DKDate& date);
  DKBoolean operator== (const DKDate& date) const;
  DKBoolean operator!= (const DKDate& date) const;
 };

Members:

Constructors and destructor
nYear is an integer in yyyy format. nDay is the day of the month, an integer between 1 and 31. The constructor without an argument creates a DKDate object with today's date. The date character input string is in yyyy-mm-dd format.
  DKDate(Month nMonth, int nDay, int nYear);
  DKDate(int nDay, Month nMonth, int nYear); 
  DKDate(int nYear, int mm, int nDay); 
  DKDate(const DKDate& date);
  DKDate(); 
  DKDate(const char* dateString);
 

Member functions

asString
Gets the string representation of this date. The input string format pFormat follows the formatting convention described in the standard C-routine strftime for the appropriate platform.
dkString asString(const char * pFormat) const;

getYear
Returns the value of the year in this date, an integer in the yyyy format.
int getYear()   const;

getMonth
Returns the value of the month in this date. The value is an integer between 1 and 12, where 1 represents the month of January.
int getMonth()  const;

getDay
Returns the day of the month in this date. The value is an integer between 1 and 31.
int getDay() const;

operator <<
Output the string representation of this date. The default format is yyyy-mm-dd, as required by the majority of datastores.
ostream& operator << (ostream& outstream, const DKDate& date);

fromString
Creates a DKDate object in yyyy-mm-dd format from an input string.
dkDate fromString (const char* dateString);

(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.