NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::DateTime Class Reference

Date Time class for working with iso formatted date times. More...

#include <DateTime.hpp>

Public Member Functions

 DateTime ()=default
 
 DateTime (const std::string &timestamp)
 
 DateTime (const TimePoint &tp)
 
 DateTime (int year, int month, int day, int hour, int minute, int second, double fractionalSecond=0.0) noexcept
 
int day () const noexcept
 day getter More...
 
double fractionalSecond () const noexcept
 fractionalSecond getter More...
 
int hour () const noexcept
 hour getter More...
 
int minute () const noexcept
 minute getter More...
 
int month () const noexcept
 month getter More...
 
int second () const noexcept
 second getter More...
 
void setDay (int day)
 day setter More...
 
void setFractionalSecond (double fractionalSecond)
 fractionalSecond setter More...
 
void setHour (int hour)
 hour setter More...
 
void setMinute (int minute)
 minute setter More...
 
void setMonth (int month)
 month setter More...
 
void setSecond (int second)
 second setter More...
 
void setYear (int year)
 year setter More...
 
std::string toStr () const
 Converts the struct to an iso string. More...
 
TimePoint toTimePoint () const
 Converts the struct to a TimePoint. More...
 
int year () const noexcept
 year getter More...
 

Static Public Member Functions

static DateTime now () noexcept
 Factory static method for returning a DateTime object cooresponding to the system clock now. More...
 
static TimePoint strToTimepoint (const std::string &timestamp)
 Converts the struct to an iso string. More...
 

Static Public Attributes

static constexpr int MAX_DAY = 31
 
static constexpr int MAX_HOUR = 23
 
static constexpr int MAX_MINUTE = 59
 
static constexpr int MAX_MONTH = 12
 
static constexpr int MAX_SECOND = 59
 

Detailed Description

Date Time class for working with iso formatted date times.

Constructor & Destructor Documentation

◆ DateTime() [1/4]

nc::DateTime::DateTime ( )
default

Constructor

◆ DateTime() [2/4]

nc::DateTime::DateTime ( const TimePoint tp)
inlineexplicit

Constructor

Parameters
tpa timepoint object

◆ DateTime() [3/4]

nc::DateTime::DateTime ( const std::string &  timestamp)
inlineexplicit

Constructor

Parameters
timestampan iso formatted datetime string (0001-01-01T00:00:00.00000Z)

◆ DateTime() [4/4]

nc::DateTime::DateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
double  fractionalSecond = 0.0 
)
inlinenoexcept

Constructor

Parameters
yearyear value
monthmonth value
dayday value
hourhour value
minuteminute value
secondsecond value
fractionalSecondfractionalSecond value

Member Function Documentation

◆ day()

int nc::DateTime::day ( ) const
inlinenoexcept

day getter

Returns
int

◆ fractionalSecond()

double nc::DateTime::fractionalSecond ( ) const
inlinenoexcept

fractionalSecond getter

Returns
double

◆ hour()

int nc::DateTime::hour ( ) const
inlinenoexcept

hour getter

Returns
int

◆ minute()

int nc::DateTime::minute ( ) const
inlinenoexcept

minute getter

Returns
int

◆ month()

int nc::DateTime::month ( ) const
inlinenoexcept

month getter

Returns
int

◆ now()

static DateTime nc::DateTime::now ( )
inlinestaticnoexcept

Factory static method for returning a DateTime object cooresponding to the system clock now.

Returns
DateTime

◆ second()

int nc::DateTime::second ( ) const
inlinenoexcept

second getter

Returns
int

◆ setDay()

void nc::DateTime::setDay ( int  day)
inline

day setter

Parameters
dayday value

◆ setFractionalSecond()

void nc::DateTime::setFractionalSecond ( double  fractionalSecond)
inline

fractionalSecond setter

Parameters
fractionalSecondfractionalSecond value

◆ setHour()

void nc::DateTime::setHour ( int  hour)
inline

hour setter

Parameters
hourhour value

◆ setMinute()

void nc::DateTime::setMinute ( int  minute)
inline

minute setter

Parameters
minuteminute value

◆ setMonth()

void nc::DateTime::setMonth ( int  month)
inline

month setter

Parameters
monthmonth value

◆ setSecond()

void nc::DateTime::setSecond ( int  second)
inline

second setter

Parameters
secondsecond value

◆ setYear()

void nc::DateTime::setYear ( int  year)
inline

year setter

Parameters
yearyear value

◆ strToTimepoint()

static TimePoint nc::DateTime::strToTimepoint ( const std::string &  timestamp)
inlinestatic

Converts the struct to an iso string.

Parameters
timestampan iso formatted datetime string (0001-01-01T00:00:00.00000Z)
Returns
Timepoint

◆ toStr()

std::string nc::DateTime::toStr ( ) const
inline

Converts the struct to an iso string.

Returns
std::string

◆ toTimePoint()

TimePoint nc::DateTime::toTimePoint ( ) const
inline

Converts the struct to a TimePoint.

Returns
TimePoint

◆ year()

int nc::DateTime::year ( ) const
inlinenoexcept

year getter

Returns
int

Field Documentation

◆ MAX_DAY

constexpr int nc::DateTime::MAX_DAY = 31
staticconstexpr

◆ MAX_HOUR

constexpr int nc::DateTime::MAX_HOUR = 23
staticconstexpr

◆ MAX_MINUTE

constexpr int nc::DateTime::MAX_MINUTE = 59
staticconstexpr

◆ MAX_MONTH

constexpr int nc::DateTime::MAX_MONTH = 12
staticconstexpr

◆ MAX_SECOND

constexpr int nc::DateTime::MAX_SECOND = 59
staticconstexpr

The documentation for this class was generated from the following file: