dbp::datetime Class Reference

Date and time class. More...

#include <datetime.h>

List of all members.

Public Types

typedef bool(datetime::* bool_type )() const

Public Member Functions

 datetime ()
 Constructor.
 datetime (const std::string &src, const std::string &fmt=DEFAULT_DATETIME_FORMAT)
 Constructor.
 datetime (const datetime &rhs)
 Copy constructor.
datetimeoperator= (const datetime &rhs)
 Assignment operator.
bool operator== (const datetime &rhs) const
 Comparison operator.
bool operator< (const datetime &rhs) const
 Comparison operator.
bool operator> (const datetime &rhs) const
 Comparison operator.
bool operator<= (const datetime &rhs) const
 Comparison operator.
bool operator>= (const datetime &rhs) const
 Comparison operator.
bool operator!= (const datetime &rhs) const
 Comparison operator.
bool operator! () const
 Comparison operator (check for empty value).
int operator- (const datetime &rhs)
 Minus operator (difference in seconds).
 operator bool_type () const
 Comparison operator (check for empty value).
datetimenow ()
 Set to current time.
int year () const
 Get year of the date.
datetimeyear (int val)
 Set year of the date.
int month () const
 Get month of the date.
datetimemonth (int val)
 Set month of the date.
int day () const
 Get day of the date.
datetimeday (int val)
 Set day of the date.
int hour () const
 Get hour of the date.
datetimehour (int val)
 Set hour of the date.
int minute () const
 Get minute of the date.
datetimeminute (int val)
 Set minute of the date.
int second () const
 Get second of the date.
datetimesecond (int val)
 Set second of the date.
void clear ()
 Clear (set to empty value).
bool empty () const
 Check for empty value.
std::string str (const std::string &format=DEFAULT_DATETIME_FORMAT) const
 Convert to local time string representation with the current locale.
std::string as_gmt () const

Detailed Description

Date and time class.

This class represents the date and time.


Member Function Documentation

std::string dbp::datetime::as_gmt (  )  const

Convert to RFC 2822 date/time string representation, i.e. "Sat, 16 May 2009 21:25:26 GMT"

std::string dbp::datetime::str ( const std::string &  format = DEFAULT_DATETIME_FORMAT  )  const

Convert to local time string representation with the current locale.

Parameters:
format a string containing any combination of regular characters and special format specifiers. These format specifiers are replaced by the function to the corresponding values to represent the time. They all begin with a percentage (%) sign, and are:

Specifier   Replaced by                         Example
-------------------------------------------------------------------------
%a          Abbreviated weekday name *          Thu
%A          Full weekday name *                 Thursday
%b          Abbreviated month name *            Aug
%B          Full month name *                   August
%c          Date and time representation *      Thu Aug 23 14:55:02 2001
%d          Day of the month (01-31)            23
%H          Hour in 24h format (00-23)          14
%I          Hour in 12h format (01-12)          02
%j          Day of the year (001-366)           235
%m          Month as a decimal number (01-12)   08
%M          Minute (00-59)                      55
%p          AM or PM designation                PM
%S          Second (00-61)                      02
%U          Week number with the first Sunday
            as the first day of
            week one (00-53)                    33
%w          Weekday as a decimal number with
            Sunday as 0 (0-6)                   4
%W          Week number with the first Monday
            as the first day of
            week one (00-53)                    34
%x          Date representation *               08/23/01
%X          Time representation *               14:55:02
%y          Year, last two digits (00-99)       01
%Y          Year                                2001
%Z          Timezone name or abbreviation       CDT
%%          A % sign                            %
-------------------------------------------------------------------------
* The specifiers whose description is marked with an asterisk (*) are
  locale-dependent.
		

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

 
Support This Project
SourceForge.net Logo