GnuCash
5.6-150-g038405b370+
|
GnuCash Date class. More...
#include <gnc-datetime.hpp>
Public Member Functions | |
GncDate () | |
Construct a GncDate representing the current day. | |
GncDate (int year, int month, int day) | |
Construct a GncDate representing the given year, month, and day in the proleptic Gregorian calendar. More... | |
GncDate (const std::string str, const std::string fmt) | |
Construct a GncDate by parsing a string assumed to be in the format passed in. More... | |
GncDate (std::unique_ptr< GncDateImpl > impl) | |
Construct a GncDate from a GncDateImpl. | |
GncDate (const GncDate &) | |
Copy constructor. | |
GncDate (GncDate &&) | |
Move constructor. | |
~GncDate () | |
Default destructor. | |
GncDate & | operator= (const GncDate &) |
Copy assignment operator. | |
GncDate & | operator= (GncDate &&) |
Move assignment operator. | |
void | today () |
Set the date object to the computer clock's current day. More... | |
gnc_ymd | year_month_day () const |
Get the year, month, and day from the date as a gnc_ymd. More... | |
std::string | format (const char *format) |
Format the GncDate into a std::string. More... | |
bool | isnull (void) |
Test that the Date has an implementation. More... | |
Static Public Attributes | |
static const std::vector< GncDateFormat > | c_formats |
A vector with all the date formats supported by the string constructor. More... | |
Friends | |
bool | operator< (const GncDate &, const GncDate &) |
bool | operator> (const GncDate &, const GncDate &) |
bool | operator== (const GncDate &, const GncDate &) |
bool | operator<= (const GncDate &, const GncDate &) |
bool | operator>= (const GncDate &, const GncDate &) |
bool | operator!= (const GncDate &, const GncDate &) |
GnuCash Date class.
The represented date is limited to the period between 1400 and 9999 CE.
Definition at line 213 of file gnc-datetime.hpp.
GncDate::GncDate | ( | int | year, |
int | month, | ||
int | day | ||
) |
Construct a GncDate representing the given year, month, and day in the proleptic Gregorian calendar.
Years are constrained to be from 1400 - 9999 CE inclusive. Dates will be normalized if the day or month values are outside of the normal ranges. e.g. 1994, -3, 47 will be normalized to 1993-10-17.
year | The year in the Common Era. |
month | The month, where 1 is January and 12 is December. |
day | The day of the month, beginning with 1. |
std::invalid_argument | if the calculated year is outside of the constrained range. |
Definition at line 840 of file gnc-datetime.cpp.
GncDate::GncDate | ( | const std::string | str, |
const std::string | fmt | ||
) |
Construct a GncDate by parsing a string assumed to be in the format passed in.
The currently recognized formats are d-m-y, m-d-y, y-m-d, m-d, d-m. Note while the format descriptions use "-" as separator any of "-" (hyphen), "/" (slash), "'" (single quote), " " (space) or "." will be accepted.
str | The string to be interpreted. |
fmt | The expected date format of the string passed in. |
std::invalid_argument | if
|
Definition at line 842 of file gnc-datetime.cpp.
std::string GncDate::format | ( | const char * | format | ) |
Format the GncDate into a std::string.
format | A cstr describing the way the date and time are presented. Code letters preceded with % stand in for arguments; most are the same as described in strftime(3), but there are a few differences. Consult the boost::date_time documentation. |
Definition at line 867 of file gnc-datetime.cpp.
|
inline |
Test that the Date has an implementation.
Definition at line 301 of file gnc-datetime.hpp.
void GncDate::today | ( | ) |
Set the date object to the computer clock's current day.
Definition at line 861 of file gnc-datetime.cpp.
gnc_ymd GncDate::year_month_day | ( | ) | const |
Get the year, month, and day from the date as a gnc_ymd.
Definition at line 873 of file gnc-datetime.cpp.
Standard comparison operators working on GncDate objects.
Definition at line 878 of file gnc-datetime.cpp.
|
static |
A vector with all the date formats supported by the string constructor.
The currently supported formats are: "y-m-d" (including yyyymmdd) "d-m-y" (including ddmmyyyy) "m-d-y" (including mmddyyyy) "d-m" (including ddmm) "m-d" (including mmdd)
Notes:
Definition at line 232 of file gnc-datetime.hpp.