Public Member Functions | Static Public Member Functions | Friends

dbDate Class Reference

#include <date.h>

List of all members.

Public Member Functions

bool operator== (dbDate const &dt)
bool operator!= (dbDate const &dt)
bool operator> (dbDate const &dt)
bool operator>= (dbDate const &dt)
bool operator< (dbDate const &dt)
bool operator<= (dbDate const &dt)
int operator- (dbDate const &dt)
int operator+ (int days)
dbDateoperator+= (int days)
dbDateoperator-= (int days)
 dbDate ()
bool isValid () const
unsigned JulianDay ()
void clear ()
 dbDate (int year, int month, int day)
void MDY (int &year, int &month, int &day) const
int day ()
int month ()
int year ()
int dayOfWeek ()
char_t * asString (char_t *buf, char_t const *format=_T("%d-%M-%Y")) const
 CLASS_DESCRIPTOR (dbDate,(KEY(jday, INDEXED|HASHED), METHOD(year), METHOD(month), METHOD(day), METHOD(dayOfWeek)))
dbQueryExpression operator== (char_t const *field)
dbQueryExpression operator!= (char_t const *field)
dbQueryExpression operator< (char_t const *field)
dbQueryExpression operator<= (char_t const *field)
dbQueryExpression operator> (char_t const *field)
dbQueryExpression operator>= (char_t const *field)

Static Public Member Functions

static dbDate current ()
static dbQueryExpression ascent (char_t const *field)
static dbQueryExpression descent (char_t const *field)

Friends

dbQueryExpression between (char_t const *field, dbDate &from, dbDate &till)

Detailed Description

Class representing date (without time)


Constructor & Destructor Documentation

dbDate::dbDate (  )  [inline]

Default constructor: invalid date

dbDate::dbDate ( int  year,
int  month,
int  day 
) [inline]

Date constructor.
Convert Gregorian calendar date to the corresponding Julian day number j. Algorithm 199 from Communications of the ACM, Volume 6, No. 8, (Aug. 1963), p. 444. Gregorian calendar started on Sep. 14, 1752. This function not valid before that.

Parameters:
year year, for example 2002
month month [1..12]
day day of month [1..31]

Member Function Documentation

static dbQueryExpression dbDate::ascent ( char_t const *  field  )  [inline, static]

Generate query expresson for ordering search result by date field in ascent order

Parameters:
field subexpression to be used in ORDER BY clause
char_t* dbDate::asString ( char_t *  buf,
char_t const *  format = _T("%d-%M-%Y") 
) const [inline]

Print date as string

Parameters:
buf buffer to receive date string
format 
d
day of month: 1-31
D
day of week: Mon, Tue,...
m
month number: 1-12
M
month name: Jan, Feb,...
y
year since 1900
Y
year: 2002
Returns:
pointer to the buffer with string
void dbDate::clear (  )  [inline]

Set date to invalid

static dbDate dbDate::current (  )  [inline, static]

Get current date

int dbDate::day (  )  [inline]

Get day of month

Returns:
day of month: 1..31
int dbDate::dayOfWeek (  )  [inline]

Get day of week

Returns:
day of the week [1..7]
static dbQueryExpression dbDate::descent ( char_t const *  field  )  [inline, static]

Generate query expresson for ordering search result by date field in descent order

Parameters:
field subexpression to be used in ORDER BY clause
bool dbDate::isValid (  )  const [inline]

Check if date is valid

unsigned dbDate::JulianDay (  )  [inline]

Get Julian day

void dbDate::MDY ( int &  year,
int &  month,
int &  day 
) const [inline]

Convert a Julian day number to its corresponding Gregorian calendar date. Algorithm 199 from Communications of the ACM, Volume 6, No. 8, (Aug. 1963), p. 444. Gregorian calendar started on Sep. 14, 1752. This function not valid before that.

Parameters:
year placeholder for year
month placeholder for month
day placeholder for day
int dbDate::month (  )  [inline]

Get month

Returns:
month of year: 1..12
dbQueryExpression dbDate::operator!= ( char_t const *  field  )  [inline]

Generate query expresson for comparing dates for inequality

Parameters:
field name of the record with date
Returns:
query subexpression which compare specified table field with this date
int dbDate::operator+ ( int  days  )  [inline]

Add specified number of days to the date

dbQueryExpression dbDate::operator< ( char_t const *  field  )  [inline]

Generate query expresson for comparing dates

Parameters:
field name of the record with date
Returns:
query subexpression which compare specified table field with this date
dbQueryExpression dbDate::operator<= ( char_t const *  field  )  [inline]

Generate query expresson for comparing dates

Parameters:
field name of the record with date
Returns:
query subexpression which compare specified table field with this date
dbQueryExpression dbDate::operator== ( char_t const *  field  )  [inline]

Generate query expresson for comparing dates for equality

Parameters:
field name of the record with date
Returns:
query subexpression which compare specified table field with this date
dbQueryExpression dbDate::operator> ( char_t const *  field  )  [inline]

Generate query expresson for comparing dates

Parameters:
field name of the record with date
Returns:
query subexpression which compare specified table field with this date
dbQueryExpression dbDate::operator>= ( char_t const *  field  )  [inline]

Generate query expresson for comparing dates

Parameters:
field name of the record with date
Returns:
query subexpression which compare specified table field with this date
int dbDate::year (  )  [inline]

Get year

Returns:
year, for example 2002

Friends And Related Function Documentation

dbQueryExpression between ( char_t const *  field,
dbDate from,
dbDate till 
) [friend]

Generate query expresson for checking that date belongs to the specfied range

Parameters:
field name of the record with date
from date specifying start of interval (inclusive)
till date specifying end of interval (inclusive)
Returns:
query subexpression which checks that specified table field belongs to the sepcifed interval

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