Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 541b305a06.
PrevUpHomeNext

datetime

Type representing MySQL DATETIME and TIMESTAMP data types.

Synopsis

Defined in header <boost/mysql/datetime.hpp>

class datetime
Types

Name

Description

time_point

A std::chrono::time_point that can represent any valid datetime.

Member Functions

Name

Description

as_time_point

Converts *this into a time_point (checked access).

datetime [constructor]

Constructs a zero datetime.

Constructs a datetime from its individual components.

Constructs a datetime from a time_point.

day

Retrieves the day component.

get_time_point

Converts *this into a time_point (unchecked access).

hour

Retrieves the hour component.

microsecond

Retrieves the microsecond component.

minute

Retrieves the minute component.

month

Retrieves the month component.

operator==

Tests for equality.

operator!=

Tests for inequality.

second

Retrieves the second component.

valid

Returns true if *this represents a valid time_point.

year

Retrieves the year component.

Static Member Functions

Name

Description

now

Returns the current system time as a datetime object.

Related Functions

Name

Description

operator<<

Streams a datetime.

Description

Represents a broken datetime by its year, month, day, hour, minute, second and microsecond components. 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 or get_time_point.

As opposed to time_point, this type allows representing invalid and zero datetimes.

Convenience header <boost/mysql.hpp>


PrevUpHomeNext