#include <date.h>
Public Member Functions | |
Date () | |
Default constructor, initializes to ``now''. | |
Date (time_t secs) | |
Date(time_t t) assumes that t is number of seconds since Jan 1, 1970. | |
Date (unsigned int year, unsigned int month, unsigned int day, unsigned int hrs=0, unsigned int min=0, unsigned int sec=0) | |
Initialize Date, note that january = 0. | |
Date (const std::string &s) throw (DateError) | |
The string s is parsed as a date. | |
std::string | str (const char *fmt=0) const |
Produce a string representing the date, according to format. | |
std::string | gmt (const char *fmt=0) const |
Like str() but formats in GMT time zone, e.g. 03:00 MET DST is 02:00 GMT. | |
void | yday (unsigned short yday) |
Set date to date with this yday in same year. | |
time_t | time () const |
Returns number of secs since 1/1/1970. | |
void | time (time_t time) |
Set time. | |
Date & | operator+= (const Duration &) |
Add a duration to a Date. | |
unsigned short | year () const |
Return number of years. | |
unsigned short | month () const |
Return month of date, january = 0. | |
unsigned short | day () const |
Return day in month (1..31). | |
unsigned short | hours () const |
Return hour of day, between 00 and 23. | |
unsigned short | minutes () const |
Return minutes in the hour, between 0 and 59. | |
unsigned short | seconds () const |
Return seconds in the minute, between 0 and 59. | |
unsigned short | wday () const |
Return weekday, sunday = 0, monday = 1, .. | |
unsigned short | yday () const |
Return day in year, between 0 and 365. | |
unsigned short | yweek () const |
Return number of week (0..53) in year, week 1 starts with first monday,. | |
void | year (unsigned short yr) |
Set year, month, day-in-month, hours, minutes or seconds. | |
void | month (unsigned short mo) |
Set year, month, day-in-month, hours, minutes or seconds. | |
void | day (unsigned short day) |
Set year, month, day-in-month, hours, minutes or seconds. | |
void | hours (unsigned short hrs) |
Set year, month, day-in-month, hours, minutes or seconds. | |
void | minutes (unsigned short mins) |
Set year, month, day-in-month, hours, minutes or seconds. | |
void | seconds (unsigned short secs) |
Set year, month, day-in-month, hours, minutes or seconds. | |
bool | operator< (const Date &d) const |
bool | operator== (const Date &d) const |
bool | operator> (const Date &d) const |
bool | operator!= (const Date &d) const |
bool | operator>= (const Date &d) const |
bool | operator<= (const Date &d) const |
Private Attributes | |
time_t | time_ |
It provides a convenient interface to system functions such as locatime_r() etc. Its only data member is a time_t value. Note that only dates since Jan 1, 1970 can be represented.
The default copy constructor and assignment operations are available.
Definition at line 36 of file date.h.
|
Default constructor, initializes to ``now''.
|
|
Date(time_t t) assumes that t is number of seconds since Jan 1, 1970.
|
|
Initialize Date, note that january = 0.
|
|
The string s is parsed as a date. This constructor uses the gnu getdate parsing function which accepts a number of formats, e.g.
1970-09-17 # ISO 8601. 70-9-17 # This century assumed by default. 70-09-17 # Leading zeros are ignored. 9/17/72 # Common U.S. writing. 24 September 1972 24 Sept 72 # September has a special abbreviation. 24 Sep 72 # Three-letter abbreviations always allowed. Sep 24, 1972 24-sep-72 24sep72 20:02:0 20:02 8:02pm 20:02-0500 # In EST (Eastern U.S. Standard Time) and many others (see the gnu filutils documentation) |
|
Produce a string representing the date, according to format. The format is any string acceptable to strftime. If fmt=0, the default is "\%a \%b \%d \%H:\%M:\%S \%Y" e.g. "Wed Aug 12 18:38:10 1998"
|
|
Like str() but formats in GMT time zone, e.g. 03:00 MET DST is 02:00 GMT.
|
|
Return number of years. Inspection functions that return a part of the Date object. |
|
Return month of date, january = 0.
|
|
Return day in month (1..31).
|
|
Return hour of day, between 00 and 23.
|
|
Return minutes in the hour, between 0 and 59.
|
|
Return seconds in the minute, between 0 and 59.
|
|
Return weekday, sunday = 0, monday = 1, ..
|
|
Return day in year, between 0 and 365.
|
|
Return number of week (0..53) in year, week 1 starts with first monday,.
|
|
Set year, month, day-in-month, hours, minutes or seconds. Functions that set part of the Date object. Values that are too large will be converted, e.g. to e.g. next day. E.g. Date d("Mon Jan 01 23:00:00 CET 2001"); d.hours(36); cout<< d.str(); |
|
Set year, month, day-in-month, hours, minutes or seconds. Functions that set part of the Date object. Values that are too large will be converted, e.g. to e.g. next day. E.g. Date d("Mon Jan 01 23:00:00 CET 2001"); d.hours(36); cout<< d.str(); |
|
Set year, month, day-in-month, hours, minutes or seconds. Functions that set part of the Date object. Values that are too large will be converted, e.g. to e.g. next day. E.g. Date d("Mon Jan 01 23:00:00 CET 2001"); d.hours(36); cout<< d.str(); |
|
Set year, month, day-in-month, hours, minutes or seconds. Functions that set part of the Date object. Values that are too large will be converted, e.g. to e.g. next day. E.g. Date d("Mon Jan 01 23:00:00 CET 2001"); d.hours(36); cout<< d.str(); |
|
Set year, month, day-in-month, hours, minutes or seconds. Functions that set part of the Date object. Values that are too large will be converted, e.g. to e.g. next day. E.g. Date d("Mon Jan 01 23:00:00 CET 2001"); d.hours(36); cout<< d.str(); |
|
Set year, month, day-in-month, hours, minutes or seconds. Functions that set part of the Date object. Values that are too large will be converted, e.g. to e.g. next day. E.g. Date d("Mon Jan 01 23:00:00 CET 2001"); d.hours(36); cout<< d.str(); |
|
Set date to date with this yday in same year.
|
|
Returns number of secs since 1/1/1970. Definition at line 131 of file date.h. References time_. Referenced by operator<(), and operator==(). |
|
Set time.
|
|
Date comparison respects chronological order. Definition at line 138 of file date.h. References time(). |
|
Date comparison respects chronological order. Definition at line 139 of file date.h. References time(). |
|
Date comparison respects chronological order. Definition at line 140 of file date.h. |
|
Date comparison respects chronological order. Definition at line 141 of file date.h. |
|
Date comparison respects chronological order. Definition at line 142 of file date.h. |
|
Date comparison respects chronological order. Definition at line 143 of file date.h. |
|
Add a duration to a Date.
|
|
Definition at line 149 of file date.h. Referenced by time(). |
dvutil-0.13.15 | [30 December, 2004] |