MySQL++: datetime.h File Reference
datetime.h File Reference

Declares classes to add SQL-compatible date and time types to C++'s type system. More...

`#include "common.h"`
`#include "comparable.h"`
`#include <string>`
`#include <iostream>`

Go to the source code of this file.

## Classes

class | mysqlpp::DateTime
| C++ form of SQL's DATETIME type. More...
class | mysqlpp::Date
| C++ form of SQL's DATE type. More...
class | mysqlpp::Time
| C++ form of SQL's TIME type. More...

## Functions

DateTime | mysqlpp::NOW ()
| Returns a DateTime object that, when inserted into query will yield a SQL "NOW()" function call.
std::ostream & | mysqlpp::operator<< (std::ostream &os, const DateTime &dt)
| Inserts a DateTime object into a C++ stream in a SQL-compatible format. More...
std::ostream & | mysqlpp::operator<< (std::ostream &os, const Date &d)
| Inserts a Date object into a C++ stream. More...
std::ostream & | mysqlpp::operator<< (std::ostream &os, const Time &t)
| Inserts a Time object into a C++ stream in a SQL-compatible format. More...

## Detailed Description

Declares classes to add SQL-compatible date and time types to C++'s type system.

## Function Documentation

## operator<<() [1/3]

MYSQLPP_EXPORT std::ostream & mysqlpp::operator<< | ( | std::ostream & | os,
|  | const Date & | d
| ) |  |

Inserts a Date object into a C++ stream.

The format is YYYY-MM-DD, zero-padded.

Parameters

  os | stream to insert date into
  d | date to insert into stream

## operator<<() [2/3]

MYSQLPP_EXPORT std::ostream & mysqlpp::operator<< | ( | std::ostream & | os,
|  | const Time & | t
| ) |  |

Inserts a Time object into a C++ stream in a SQL-compatible format.

The format is HH:MM:SS, zero-padded.

Parameters

  os | stream to insert time into
  t | time to insert into stream

## operator<<() [3/3]

MYSQLPP_EXPORT std::ostream & mysqlpp::operator<< | ( | std::ostream & | os,
|  | const DateTime & | dt
| ) |  |

Inserts a DateTime object into a C++ stream in a SQL-compatible format.

The date and time are inserted into the stream, in that order, with a space between them.

Parameters

  os | stream to insert date and time into
  dt | date/time object to insert into stream