...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 DATETIME
and TIMESTAMP
data types.
Defined in header <boost/mysql/datetime.hpp>
class datetime;
Name |
Description |
---|---|
A |
|
A |
Name |
Description |
---|---|
Converts |
|
Converts |
|
datetime [constructor] |
Constructs a zero datetime. |
Retrieves the day component (1-based). |
|
Converts |
|
Converts |
|
Retrieves the hour component. |
|
Retrieves the microsecond component. |
|
Retrieves the minute component. |
|
Retrieves the month component (1-based). |
|
Tests for inequality. |
|
Tests for equality. |
|
Retrieves the second component. |
|
Returns |
|
Retrieves the year component. |
Name |
Description |
---|---|
Returns the current system time as a datetime object. |
Name |
Description |
---|---|
Streams a datetime. |
Represents a Gregorian date and time broken by its year, month, day, hour, minute, second and microsecond 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
.
Datetimes 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 datetimes. These values
are allowed by MySQL but don't represent real time points.
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.
Convenience header <boost/mysql.hpp>