Etterna 0.74.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
DateTime Struct Reference

A standard way of determining the date and the time. More...

#include <DateTime.h>

Public Member Functions

 DateTime ()
 Set up a default date and time.
 
void Init ()
 Initialize the date and time.
 
auto operator< (const DateTime &other) const -> bool
 Determine if this DateTime is less than some other time.
 
auto operator> (const DateTime &other) const -> bool
 Determine if this DateTime is greater than some other time.
 
auto operator== (const DateTime &other) const -> bool
 Determine if this DateTime is equal to some other time.
 
auto operator!= (const DateTime &other) const -> bool
 Determine if this DateTime is not equal to some other time.
 
auto operator<= (const DateTime &other) const -> bool
 Determine if this DateTime is less than or equal to some other time.
 
auto operator>= (const DateTime &other) const -> bool
 Determine if this DateTime is greater than or equal to some other time.
 
void StripTime ()
 Remove the time portion from the date.
 
auto GetString () const -> std::string
 Retrieve a string representation of the current date and time.
 
auto FromString (const std::string &sDateTime) -> bool
 Attempt to turn a string into a DateTime.
 

Static Public Member Functions

static auto GetNowDateTime () -> DateTime
 Retrieve the current date and time.
 
static auto GetNowDate () -> DateTime
 Retrieve the current date.
 
static auto GetFromString (const std::string &str) -> DateTime
 
static auto GetYesterday () -> DateTime
 

Public Attributes

int tm_sec
 The number of seconds after the minute.
 
int tm_min
 The number of minutes after the hour.
 
int tm_hour
 The number of hours since midnight (or 0000 hours).
 
int tm_mday
 The specified day of the current month.
 
int tm_mon
 The number of months since January.
 
int tm_year
 The number of years since the year 1900.
 

Detailed Description

A standard way of determining the date and the time.

Member Function Documentation

◆ FromString()

bool DateTime::FromString ( const std::string &  sDateTime) -> bool

Attempt to turn a string into a DateTime.

Parameters
sDateTimethe string to attempt to convert.
Returns
true if the conversion worked, or false otherwise.

◆ GetNowDate()

DateTime DateTime::GetNowDate ( ) -> DateTime
static

Retrieve the current date.

Returns
the current date.

◆ GetNowDateTime()

DateTime DateTime::GetNowDateTime ( ) -> DateTime
static

Retrieve the current date and time.

Returns
the current date and time.

◆ GetString()

std::string DateTime::GetString ( ) const -> std::string

Retrieve a string representation of the current date and time.

This returns a common SQL/XML format: "YYYY-MM-DD HH:MM:SS".

Returns
the string representation of the date and time.

◆ operator!=()

auto DateTime::operator!= ( const DateTime other) const -> bool
inline

Determine if this DateTime is not equal to some other time.

Parameters
otherthe other DateTime to check.
Returns
true if this is not equal to the other time, or false otherwise.

◆ operator<()

bool DateTime::operator< ( const DateTime other) const -> bool

Determine if this DateTime is less than some other time.

Parameters
otherthe other DateTime to check.
Returns
true if this is less than the other time, or false otherwise.

◆ operator<=()

auto DateTime::operator<= ( const DateTime other) const -> bool
inline

Determine if this DateTime is less than or equal to some other time.

Parameters
otherthe other DateTime to check.
Returns
true if this is less than or equal to the other time, or false otherwise.

◆ operator==()

bool DateTime::operator== ( const DateTime other) const -> bool

Determine if this DateTime is equal to some other time.

Parameters
otherthe other DateTime to check.
Returns
true if this is equal to the other time, or false otherwise.

◆ operator>()

bool DateTime::operator> ( const DateTime other) const -> bool

Determine if this DateTime is greater than some other time.

Parameters
otherthe other DateTime to check.
Returns
true if this is greater than the other time, or false otherwise.

◆ operator>=()

auto DateTime::operator>= ( const DateTime other) const -> bool
inline

Determine if this DateTime is greater than or equal to some other time.

Parameters
otherthe other DateTime to check.
Returns
true if this is greater than or equal to the other time, or false otherwise.

Member Data Documentation

◆ tm_hour

int DateTime::tm_hour

The number of hours since midnight (or 0000 hours).

Valid values are [0, 23].

◆ tm_mday

int DateTime::tm_mday

The specified day of the current month.

Valid values are [1, 31].

XXX: Is it possible to set an illegal date through here, such as day 30 of February? -Wolfman2000

◆ tm_min

int DateTime::tm_min

The number of minutes after the hour.

Valid values are [0, 59].

◆ tm_mon

int DateTime::tm_mon

The number of months since January.

Valid values are [0, 11].

◆ tm_sec

int DateTime::tm_sec

The number of seconds after the minute.

Valid values are [0, 59].


The documentation for this struct was generated from the following files: