Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBDateTime



Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/db/datetime.h>

RWDBDateTime now; // construct current date and time
RWDBDateTime then((unsigned)1993,2,27,10,2,54)

Description

RWDBDateTime represents a date stored as a Julian day number, plus a time stored as the number of milliseconds since midnight. The member function isValid() can be used to determine whether an RWDBDateTime is a valid date and time. Note that RWDBDateTime is instantiated from the local system and not the database.

RWDBDateTime instances can be converted to and from RWDate and/or RWTime instances, and to and from the Standard C library type struct tm defined in <time.h>.

Output formatting is done using an RWLocale object. The default locale formats data according to US conventions. See the Tools.h++ Class Reference for further discussion of RWLocale.

Because the default constructor for this class creates an instance holding the current date and time as provided by the local system, constructing a large array of RWDBDateTimes may be quite slow. If this is an issue, declare your arrays with a class derived from RWDBDateTime that provides a faster constructor.

Related Classes

RWDate and RWTime can be used to create RWDBDateTime instances. Please see your Tools.h++ documentation for information on RWDate and RWTime.

RWLocale is used to format the output of RWDBDateTime. Please see your Tools.h++ documentation for information on RWLocale. Note that the character u can be used with RWLocale to denote milliseconds.

Public Constructors

RWDBDateTime();
RWDBDateTime(const RWDBDateTime&);
RWDBDateTime(const struct tm* tm,    
             const RWZone& zone = RWZone::local());
RWDBDateTime(const RWTime& time, 
             const RWZone& zone = RWZone::local());
RWDBDateTime(const RWDate& date, unsigned hour = 0,
             unsigned minute = 0, unsigned second = 0,
             unsigned millisecond = 0,
             const RWZone& zone = RWZone::local());
RWDBDateTime(const RWDate& date, 
             const RWCString& str,
             const RWZone& zone = RWZone::local(),
             const RWLocale& = RWLocale::global());
RWDBDateTime(unsigned year, unsigned month, unsigned day,
             unsigned hour = 0, unsigned minute = 0,
             unsigned second = 0, unsigned millisecond = 0, 
             const RWZone& zone = RWZone::local());
RWDBDateTime(unsigned long jd, unsigned hour = 0,
             unsigned minute = 0, unsigned second = 0,
             unsigned millisecond = 0, const RWZone& zone =
             RWZone::local());

Public Member Operator

RWDBDateTime& 
operator=(const RWDBDateTime& dt);

Public Member Functions

RWDBDateTime
addDays(int num);
RWDBDateTime
addHours(int num);
RWDBDateTime
addMilliseconds(long num);
RWDBDateTime
addMinutes(int num);
RWDBDateTime
addMonths(int num);
RWDBDateTime
addSeconds(int num);
RWDBDateTime
addYears(int num);
RWCString
asString() const; 
RWCString
asString(char format, const RWZone& zone = RWZone::local(),
         const RWLocale& locale = RWLocale::global()) const;
RWCString
asString(const char *format) const; 
RWCString
asString(const char* format, 
         const RWZone& zone = RWZone::local(),
         const RWLocale& locale = RWLocale::global())const;
RWBoolean
between(const RWDBDateTime& dt1, 
        const RWDBDateTime& dt2) const;
RWspace
binaryStoreSize() const;
int 
compareTo(const RWDate* d) const;
int 
compareTo(const RWDBDateTime* dt) const;
int
compareTo(const RWTime* t) const;
unsigned 
day() const;
unsigned 
dayOfMonth() const;
void 
extract(struct tm* tmbuf, 
        const RWZone& zone = RWZone::local()) const;
unsigned 
firstDayOfMonth() const;
unsigned 
firstDayOfMonth(unsigned month) const;
unsigned 
hash() const;
unsigned 
hour(const RWZone& zone = RWZone::local()) const;
unsigned
hourGMT() const;
RWBoolean
isDST(const RWZone& zone = RWZone::local()) const;
RWBoolean
isEqual(const RWDBDateTime& dt) const;
RWBoolean 
isValid() const;
RWBoolean 
leap() const;
RWDBDateTime
max(const RWDBDateTime& dt) const;
unsigned
millisecond() const;
RWDBDateTime
min(const RWDBDateTime& dt) const;
unsigned
minute(const RWZone& timezone = RWZone::local()) const;
unsigned
minuteGMT() const;
unsigned 
month() const;
RWCString
monthName(const RWLocale& locale = RWLocale::global()) const;
void
now();
RWDBDateTime
previous(unsigned dayNum) const;
RWDBDateTime
previous(const char* dayName, 
         const RWLocale& locale = RWLocale::global()) const;
void
restoreFrom(RWFile& file);
void
restoreFrom(RWvistream& vis);
RWDate
rwdate() const;
RWTime 
rwtime() const;
void
saveOn(RWFile& file) const;
void
saveOn(RWvostream& vos) const;
unsigned
second() const;
unsigned long
seconds() const;
unsigned 
weekDay() const;
RWCString 
weekDayName(const RWLocale& locale = 
            RWLocale::global()) const;
unsigned
year() const;

Related Global Operators

RWBoolean
operator<(const RWDBDateTime& dt1, 
          const RWDBDateTime& dt2);
RWBoolean 
operator<=(const RWDBDateTime& dt1,
           const RWDBDateTime& dt2);
RWBoolean
operator>(const RWDBDateTime& dt1,
          const RWDBDateTime& dt2);
RWBoolean 
operator>=(const RWDBDateTime& dt1,
           const RWDBDateTime& dt2);
RWBoolean 
operator==(const RWDBDateTime& dt1,
           const RWDBDateTime& dt2);
RWBoolean 
operator!=(const RWDBDateTime& dt1,
           const RWDBDateTime& dt2);


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.