date_time_t

Defined in header: <orcus/types.hpp>

struct date_time_t

Struct that holds a date or date-time value.

Public Functions

date_time_t()
date_time_t(int _year, int _month, int _day)
date_time_t(int _year, int _month, int _day, int _hour, int _minute, double _second)
date_time_t(const date_time_t &other)
~date_time_t()
date_time_t &operator=(date_time_t other)
bool operator==(const date_time_t &other) const
bool operator!=(const date_time_t &other) const
bool operator<(const date_time_t &other) const
std::string to_string() const

Convert the date-time value to an ISO-formatted string representation.

Returns:

ISO-formatted string representation of the date-time value.

void swap(date_time_t &other)

Swap the value with another instance.

Parameters:

other – another instance to swap values with.

Public Members

int year
int month
int day
int hour
int minute
double second

Public Static Functions

static date_time_t from_chars(std::string_view str)

Parse an ISO-formatted string representation of a date-time value, and convert it into a date_time_t value. A string representation allows either a date only or a date and time value, but it does not allow a time only value.

Here are some examples of ISO-formatted date and date-time values:

  • 2013-04-09 (date only)

  • 2013-04-09T21:34:09.55 (date and time)

Parameters:

str – string representation of a date-time value.

Returns:

converted date-time value consisting of a set of numeric values.