C++ Utilities  4.17.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
Classes | Enumerations | Functions
ChronoUtilities Namespace Reference

Contains classes providing a means for handling date and time information. More...

Classes

class  DateTime
 Represents an instant in time, typically expressed as a date and time of day. More...
 
class  Period
 Represents a period of time. More...
 
class  TimeSpan
 Represents a time interval. More...
 

Enumerations

enum  DateTimeOutputFormat {
  DateTimeOutputFormat::DateAndTime, DateTimeOutputFormat::DateOnly, DateTimeOutputFormat::TimeOnly, DateTimeOutputFormat::DateTimeAndWeekday,
  DateTimeOutputFormat::DateTimeAndShortWeekday
}
 Specifies the output format. More...
 
enum  DayOfWeek {
  DayOfWeek::Monday, DayOfWeek::Tuesday, DayOfWeek::Wednesday, DayOfWeek::Thursday,
  DayOfWeek::Friday, DayOfWeek::Saturday, DayOfWeek::Sunday
}
 Specifies the day of the week. More...
 
enum  DatePart { DatePart::Year, DatePart::Month, DatePart::DayOfYear, DatePart::Day }
 Specifies the date part. More...
 
enum  TimeSpanOutputFormat { TimeSpanOutputFormat::Normal, TimeSpanOutputFormat::WithMeasures, TimeSpanOutputFormat::TotalSeconds }
 Specifies the output format. More...
 

Functions

DateTime CPP_UTILITIES_EXPORT operator+ (DateTime begin, Period period)
 Adds the specified period to the specified date. More...
 

Detailed Description

Contains classes providing a means for handling date and time information.

Enumeration Type Documentation

◆ DatePart

Specifies the date part.

Remarks
Intended for internal use only.
See also
DateTime::getDatePart()
Enumerator
Year 

year

Month 

month

DayOfYear 

day of year

Day 

day

Definition at line 45 of file datetime.h.

◆ DateTimeOutputFormat

Specifies the output format.

See also
DateTime::toString()
Enumerator
DateAndTime 

date and time

DateOnly 

date only

TimeOnly 

time only

DateTimeAndWeekday 

date with weekday and time

DateTimeAndShortWeekday 

date with abbreviated weekday and time

Definition at line 18 of file datetime.h.

◆ DayOfWeek

Specifies the day of the week.

See also
DateTime::dayOfWeek()
Enumerator
Monday 

Monday

Tuesday 

Tuesday

Wednesday 

Wednesday

Thursday 

Thursday

Friday 

Friday

Saturday 

Saturday

Sunday 

Sunday

Definition at line 30 of file datetime.h.

◆ TimeSpanOutputFormat

Specifies the output format.

See also
TimeSpan::toString()
Enumerator
Normal 

the normal form of specifing a time interval: hh:mm:ss

WithMeasures 

measures are used, eg.: 34 d 5 h 10 min 7 s 31 ms

TotalSeconds 

total seconds (as returned by totalSeconds()), eg. 2304.342

Definition at line 22 of file timespan.h.

Function Documentation

◆ operator+()

DateTime ChronoUtilities::operator+ ( DateTime  begin,
Period  period 
)

Adds the specified period to the specified date.

Exceptions
Mightthrow ConversionException if resulting DateTime would be out-of-range.
Remarks
  • The order in which the years(), month() and days() are added matters. See the overall class description.
  • Since the accuracy of Period is only one day, the DateTime::timeOfDay() of the result always equals begin.timeOfDay().

Definition at line 62 of file period.cpp.