Orcus
Loading...
Searching...
No Matches
orcus::date_time_t Struct Reference

#include <types.hpp>

Public Member Functions

 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_toperator= (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
 
void swap (date_time_t &other)
 

Static Public Member Functions

static date_time_t from_chars (std::string_view str)
 

Public Attributes

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

Detailed Description

Struct that holds a date or date-time value.

Member Function Documentation

◆ from_chars()

static date_time_t orcus::date_time_t::from_chars ( std::string_view str)
static

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
strstring representation of a date-time value.
Returns
converted date-time value consisting of a set of numeric values.

◆ swap()

void orcus::date_time_t::swap ( date_time_t & other)

Swap the value with another instance.

Parameters
otheranother instance to swap values with.

◆ to_string()

std::string orcus::date_time_t::to_string ( ) const

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

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