OpenStudio:utilities
Loading...
Searching...
No Matches
openstudio::Date Class Reference

#include <Date.hpp>

Public Types

using ImplType = boost::gregorian::date
 impl type is boost::gregorian::date
 

Public Member Functions

int assumedBaseYear () const
 assumed base year
 
boost::optional< intbaseYear () const
 user provided base year
 
void baseYear (int baseYear)
 set base year
 
 Date ()
 default constructor
 
 Date (const Date &other)
 copy constructor
 
 Date (const ImplType &impl)
 from impl
 
 Date (const std::string &string)
 constructor from string
 
 Date (MonthOfYear monthOfYear, unsigned dayOfMonth)
 Date from month, day of month.
 
 Date (MonthOfYear monthOfYear, unsigned dayOfMonth, const YearDescription &yearDescription)
 Date from YearDescription, month, and day of month.
 
 Date (MonthOfYear monthOfYear, unsigned dayOfMonth, int year)
 Date from month, day of month, year.
 
 Date (tm t_tm)
 Date from a system tm structure.
 
unsigned dayOfMonth () const
 day of month
 
DayOfWeek dayOfWeek () const
 day of the week
 
unsigned dayOfYear () const
 day of year
 
bool isLeapYear () const
 is assumed year a leap year
 
MonthOfYear monthOfYear () const
 month of year
 
bool operator!= (const Date &other) const
 non-equality operator
 
Date operator+ (const Time &time) const
 addition operator
 
Dateoperator+= (const Time &time)
 assignment by addition operator
 
Time operator- (const Date &date) const
 time duration
 
Date operator- (const Time &time) const
 difference operator
 
Dateoperator-= (const Time &time)
 assignment by difference operator
 
bool operator< (const Date &rhs) const
 less than operator
 
bool operator<= (const Date &rhs) const
 less than equals operator
 
Dateoperator= (const Date &other)
 assignment operator
 
bool operator== (const Date &other) const
 equality operator
 
bool operator> (const Date &rhs) const
 greater than operator
 
bool operator>= (const Date &rhs) const
 greater than equals operator
 
int year () const
 year
 
 ~Date ()=default
 destructor
 

Static Public Member Functions

static Date currentDate ()
 get current Date
 
static Date fromDayOfYear (unsigned dayOfYear)
 Day of year generators.
 
static Date fromDayOfYear (unsigned dayOfYear, const YearDescription &yearDescription)
 
static Date fromDayOfYear (unsigned dayOfYear, int year)
 
static Date fromNthDayOfMonth (NthDayOfWeekInMonth n, DayOfWeek dayOfWeek, MonthOfYear monthOfYear)
 nth weekday of month generators
 
static Date fromNthDayOfMonth (NthDayOfWeekInMonth n, DayOfWeek dayOfWeek, MonthOfYear monthOfYear, int year)
 
static bool isLeapYear (int year)
 is year a leap year
 
static openstudio::LogChannel logChannel ()
 

Detailed Description

Date is an absolute unit of time, resolution to the day Date is simple wrapper around boost::gregorian::date.

Member Typedef Documentation

◆ ImplType

using openstudio::Date::ImplType = boost::gregorian::date

impl type is boost::gregorian::date

Constructor & Destructor Documentation

◆ Date() [1/8]

openstudio::Date::Date ( )

default constructor

◆ ~Date()

openstudio::Date::~Date ( )
default

destructor

◆ Date() [2/8]

openstudio::Date::Date ( const ImplType & impl)

from impl

◆ Date() [3/8]

openstudio::Date::Date ( MonthOfYear monthOfYear,
unsigned dayOfMonth )

Date from month, day of month.

◆ Date() [4/8]

openstudio::Date::Date ( MonthOfYear monthOfYear,
unsigned dayOfMonth,
int year )

Date from month, day of month, year.

◆ Date() [5/8]

openstudio::Date::Date ( MonthOfYear monthOfYear,
unsigned dayOfMonth,
const YearDescription & yearDescription )

Date from YearDescription, month, and day of month.

◆ Date() [6/8]

openstudio::Date::Date ( const std::string & string)

constructor from string

◆ Date() [7/8]

openstudio::Date::Date ( tm t_tm)

Date from a system tm structure.

◆ Date() [8/8]

openstudio::Date::Date ( const Date & other)

copy constructor

Member Function Documentation

◆ assumedBaseYear()

int openstudio::Date::assumedBaseYear ( ) const

assumed base year

◆ baseYear() [1/2]

boost::optional< int > openstudio::Date::baseYear ( ) const

user provided base year

◆ baseYear() [2/2]

void openstudio::Date::baseYear ( int baseYear)

set base year

◆ currentDate()

static Date openstudio::Date::currentDate ( )
static

get current Date

◆ dayOfMonth()

unsigned openstudio::Date::dayOfMonth ( ) const

day of month

◆ dayOfWeek()

DayOfWeek openstudio::Date::dayOfWeek ( ) const

day of the week

◆ dayOfYear()

unsigned openstudio::Date::dayOfYear ( ) const

day of year

◆ fromDayOfYear() [1/3]

static Date openstudio::Date::fromDayOfYear ( unsigned dayOfYear)
static

Day of year generators.

◆ fromDayOfYear() [2/3]

static Date openstudio::Date::fromDayOfYear ( unsigned dayOfYear,
const YearDescription & yearDescription )
static

◆ fromDayOfYear() [3/3]

static Date openstudio::Date::fromDayOfYear ( unsigned dayOfYear,
int year )
static

◆ fromNthDayOfMonth() [1/2]

static Date openstudio::Date::fromNthDayOfMonth ( NthDayOfWeekInMonth n,
DayOfWeek dayOfWeek,
MonthOfYear monthOfYear )
static

nth weekday of month generators

◆ fromNthDayOfMonth() [2/2]

static Date openstudio::Date::fromNthDayOfMonth ( NthDayOfWeekInMonth n,
DayOfWeek dayOfWeek,
MonthOfYear monthOfYear,
int year )
static

◆ isLeapYear() [1/2]

bool openstudio::Date::isLeapYear ( ) const

is assumed year a leap year

◆ isLeapYear() [2/2]

static bool openstudio::Date::isLeapYear ( int year)
static

is year a leap year

◆ logChannel()

static openstudio::LogChannel openstudio::Date::logChannel ( )
inlinestatic

◆ monthOfYear()

MonthOfYear openstudio::Date::monthOfYear ( ) const

month of year

◆ operator!=()

bool openstudio::Date::operator!= ( const Date & other) const

non-equality operator

◆ operator+()

Date openstudio::Date::operator+ ( const Time & time) const

addition operator

◆ operator+=()

Date & openstudio::Date::operator+= ( const Time & time)

assignment by addition operator

◆ operator-() [1/2]

Time openstudio::Date::operator- ( const Date & date) const

time duration

◆ operator-() [2/2]

Date openstudio::Date::operator- ( const Time & time) const

difference operator

◆ operator-=()

Date & openstudio::Date::operator-= ( const Time & time)

assignment by difference operator

◆ operator<()

bool openstudio::Date::operator< ( const Date & rhs) const

less than operator

◆ operator<=()

bool openstudio::Date::operator<= ( const Date & rhs) const

less than equals operator

◆ operator=()

Date & openstudio::Date::operator= ( const Date & other)

assignment operator

◆ operator==()

bool openstudio::Date::operator== ( const Date & other) const

equality operator

◆ operator>()

bool openstudio::Date::operator> ( const Date & rhs) const

greater than operator

◆ operator>=()

bool openstudio::Date::operator>= ( const Date & rhs) const

greater than equals operator

◆ year()

int openstudio::Date::year ( ) const

year