Public Member Functions | Static Public Member Functions | Friends

dbDateTime Class Reference

#include <datetime.h>

List of all members.

Public Member Functions

bool operator== (dbDateTime const &dt) const
bool operator!= (dbDateTime const &dt) const
bool operator> (dbDateTime const &dt) const
bool operator>= (dbDateTime const &dt) const
bool operator< (dbDateTime const &dt) const
bool operator<= (dbDateTime const &dt) const
int operator- (dbDateTime const &dt) const
int operator+ (dbDateTime const &dt) const
 dbDateTime (time_t t)
 dbDateTime ()
bool isValid () const
time_t asTime_t () const
void clear ()
 dbDateTime (int year, int month, int day, int hour=0, int min=0, int sec=0)
 dbDateTime (int hour, int min)
int year ()
int month ()
int day ()
int dayOfYear ()
int dayOfWeek ()
int hour ()
int minute ()
int second ()
char_t * asString (char *buf, int buf_size, char_t const *format="%c") const
 CLASS_DESCRIPTOR (dbDateTime,(KEY(stamp, INDEXED|HASHED), METHOD(year), METHOD(month), METHOD(day), METHOD(dayOfYear), METHOD(dayOfWeek), METHOD(hour), METHOD(minute), METHOD(second)))
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 dbDateTime current ()
static dbDateTime currentDate ()
static dbQueryExpression ascent (char_t const *field)
static dbQueryExpression descent (char_t const *field)

Friends

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

Detailed Description

Date and time class


Constructor & Destructor Documentation

dbDateTime::dbDateTime ( time_t  t  )  [inline]

Date constructor from time in seconds since midnight, January 1, 1970 UTC.

dbDateTime::dbDateTime (  )  [inline]

Constructor of invalid timestamp

dbDateTime::dbDateTime ( int  year,
int  month,
int  day,
int  hour = 0,
int  min = 0,
int  sec = 0 
) [inline]

Construct timestamp

Parameters:
year year in long format
month month 1..12
day day of month 1..31
hour hour 0..23
min minute 0..59
sec second 0..59
dbDateTime::dbDateTime ( int  hour,
int  min 
) [inline]

Construct timestamp with only time specified


Member Function Documentation

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

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

Parameters:
field subexpression to be used in ORDER BY clause
char_t* dbDateTime::asString ( char *  buf,
int  buf_size,
char_t const *  format = "%c" 
) const [inline]

Convert timestamp to string

Parameters:
buf buffer to receive formatted string
buf_size size of the buffer
format format as in C library strftime function
Returns:
pointer to the buffer
time_t dbDateTime::asTime_t (  )  const [inline]

Convert to number of seconds since midnight, January 1, 1970 UTC.

void dbDateTime::clear (  )  [inline]

Set invalid timestamp

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

Get current timestmap

static dbDateTime dbDateTime::currentDate (  )  [inline, static]

Get current timestamp

int dbDateTime::day (  )  [inline]

Get day 1..31

int dbDateTime::dayOfWeek (  )  [inline]

Get day of week 1..7

int dbDateTime::dayOfYear (  )  [inline]

Get day of year 1..366

static dbQueryExpression dbDateTime::descent ( char_t const *  field  )  [inline, static]

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

Parameters:
field subexpression to be used in ORDER BY clause
int dbDateTime::hour (  )  [inline]

Get hour: 0..23

bool dbDateTime::isValid (  )  const [inline]

Check if timestamp is valid

int dbDateTime::minute (  )  [inline]

Get minute: 0..59

int dbDateTime::month (  )  [inline]

Get month: 1..12

dbQueryExpression dbDateTime::operator!= ( char_t const *  field  )  [inline]

Generate query expresson for comparing timestamps for inequality

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

Generate query expresson for comparing timestamps

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

Generate query expresson for comparing timestamps

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

Generate query expresson for comparing timestamps for equality

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

Generate query expresson for comparing timestamps

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

Generate query expresson for comparing timestamps

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

Get second: 0..59

int dbDateTime::year (  )  [inline]

Get year, for example 2002


Friends And Related Function Documentation

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

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

Parameters:
field name of the record of type dbDateTime
from timestamp specifying start of interval (inclusive)
till timestamp 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: