...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Type representing MySQL DATE
data type.
Defined in header <boost/mysql/date.hpp>
class date
Name |
Description |
---|---|
A |
Name |
Description |
---|---|
Converts |
|
Converts |
|
date [constructor] |
Constructs a zero date. |
Retrieves the day component (1-based). |
|
Converts |
|
Converts |
|
Retrieves the month component (1-based). |
|
Tests for equality. |
|
Tests for inequality. |
|
Returns |
|
Retrieves the year component. |
Name |
Description |
---|---|
Returns the current system time as a date object. |
Name |
Description |
---|---|
Streams a date. |
Represents a Gregorian date broken by its year, month and day components, without a time zone.
This type is close to the protocol and should not be used as a vocabulary
type. Instead, cast it to a std::chrono::time_point
by calling as_time_point
, get_time_point
, as_local_time_point
or get_local_time_point
.
Dates retrieved from MySQL don't include any time zone information. Determining
the time zone is left to the application. Thus, any time point obtained from
this class should be interpreted as a local time in an unspecified time zone,
like std::chrono::local_time
. For compatibility with older
compilers, as_time_point
and get_time_point
return system_clock
time points. These should
be interpreted as local times rather than UTC. Prefer using as_local_time_point
or get_local_time_point
if your compiler
supports them, as they provide more accurate semantics.
As opposed to time_point
,
this type allows representing MySQL invalid and zero dates. These values
are allowed by MySQL but don't represent real dates.
Note: using std::chrono
time zone functionality under MSVC
may cause memory leaks to be reported. See this
issue for an explanation and this
other issue for a workaround.