C++ Utilities  5.3.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
datetime.h
Go to the documentation of this file.
1 #ifndef CHRONO_UTILITIES_DATETIME_H
2 #define CHRONO_UTILITIES_DATETIME_H
3 
4 #include "./timespan.h"
5 
6 #include <cstdint>
7 #include <ctime>
8 #include <limits>
9 #include <string>
10 
11 namespace CppUtilities {
12 
18  DateAndTime,
19  DateOnly,
20  TimeOnly,
23 };
24 
29 enum class DayOfWeek {
30  Monday,
31  Tuesday,
32  Wednesday,
33  Thursday,
34  Friday,
35  Saturday,
36  Sunday
37 };
38 
44 enum class DatePart {
45  Year,
46  Month,
47  DayOfYear,
48  Day
49 };
50 
52 public:
53  explicit constexpr DateTime();
54  explicit constexpr DateTime(std::uint64_t ticks);
55  static DateTime fromDate(int year = 1, int month = 1, int day = 1);
56  static DateTime fromTime(int hour = 0, int minute = 0, int second = 0, double millisecond = 0.0);
57  static DateTime fromDateAndTime(int year = 1, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, double millisecond = 0.0);
58  static DateTime fromString(const std::string &str);
59  static DateTime fromString(const char *str);
60  static std::pair<DateTime, TimeSpan> fromIsoString(const char *str);
61  static DateTime fromIsoStringGmt(const char *str);
62  static DateTime fromIsoStringLocal(const char *str);
63  static DateTime fromTimeStamp(std::time_t timeStamp);
64  constexpr static DateTime fromTimeStampGmt(std::time_t timeStamp);
65  template <typename TimePoint> static DateTime fromChronoTimePoint(TimePoint timePoint);
66  template <typename TimePoint> constexpr static DateTime fromChronoTimePointGmt(TimePoint timePoint);
67 
68  constexpr std::uint64_t &ticks();
69  constexpr std::uint64_t totalTicks() const;
70  int year() const;
71  int month() const;
72  int day() const;
73  int dayOfYear() const;
74  constexpr DayOfWeek dayOfWeek() const;
75  constexpr int hour() const;
76  constexpr int minute() const;
77  constexpr int second() const;
78  constexpr int millisecond() const;
79  constexpr int microsecond() const;
80  constexpr int nanosecond() const;
81  constexpr bool isNull() const;
82  constexpr TimeSpan timeOfDay() const;
83  bool isLeapYear() const;
84  constexpr bool isEternity() const;
85  constexpr bool isSameDay(const DateTime &other) const;
86  std::string toString(DateTimeOutputFormat format = DateTimeOutputFormat::DateAndTime, bool noMilliseconds = false) const;
87  void toString(std::string &result, DateTimeOutputFormat format = DateTimeOutputFormat::DateAndTime, bool noMilliseconds = false) const;
88  std::string toIsoString(TimeSpan timeZoneDelta = TimeSpan()) const;
89  constexpr std::time_t toTimeStamp() const;
90  static const char *printDayOfWeek(DayOfWeek dayOfWeek, bool abbreviation = false);
91 
92  static constexpr DateTime eternity();
93  static constexpr DateTime unixEpochStart();
94  static DateTime now();
95  static DateTime gmtNow();
96 #if defined(PLATFORM_UNIX) && !defined(PLATFORM_MAC)
97  static DateTime exactGmtNow();
98 #endif
99  constexpr static bool isLeapYear(int year);
100  static int daysInMonth(int year, int month);
101 
102  constexpr bool operator==(const DateTime &other) const;
103  constexpr bool operator!=(const DateTime &other) const;
104  constexpr bool operator<(const DateTime &other) const;
105  constexpr bool operator>(const DateTime &other) const;
106  constexpr bool operator<=(const DateTime &other) const;
107  constexpr bool operator>=(const DateTime &other) const;
108  constexpr DateTime operator+(const TimeSpan &timeSpan) const;
109  constexpr DateTime operator-(const TimeSpan &timeSpan) const;
110  constexpr TimeSpan operator+(const DateTime &other) const;
111  constexpr TimeSpan operator-(const DateTime &other) const;
112  DateTime &operator+=(const TimeSpan &timeSpan);
113  DateTime &operator-=(const TimeSpan &timeSpan);
114 
115 private:
116  static std::uint64_t dateToTicks(int year, int month, int day);
117  static std::uint64_t timeToTicks(int hour, int minute, int second, double millisecond);
118  int getDatePart(DatePart part) const;
119 
120  std::uint64_t m_ticks;
121  static const int m_daysPerYear;
122  static const int m_daysPer4Years;
123  static const int m_daysPer100Years;
124  static const int m_daysPer400Years;
125  static const int m_daysTo1601;
126  static const int m_daysTo1899;
127  static const int m_daysTo10000;
128  static const int m_daysToMonth365[13];
129  static const int m_daysToMonth366[13];
130  static const int m_daysInMonth365[12];
131  static const int m_daysInMonth366[12];
132 };
133 
137 constexpr inline DateTime::DateTime()
138  : m_ticks(0)
139 {
140 }
141 
145 constexpr inline DateTime::DateTime(std::uint64_t ticks)
146  : m_ticks(ticks)
147 {
148 }
149 
154 inline DateTime DateTime::fromDate(int year, int month, int day)
155 {
156  return DateTime(dateToTicks(year, month, day));
157 }
158 
163 inline DateTime DateTime::fromTime(int hour, int minute, int second, double millisecond)
164 {
165  return DateTime(timeToTicks(hour, minute, second, millisecond));
166 }
167 
173 inline DateTime DateTime::fromDateAndTime(int year, int month, int day, int hour, int minute, int second, double millisecond)
174 {
175  if (std::uint64_t ticks = dateToTicks(year, month, day)) {
176  return DateTime(ticks + timeToTicks(hour, minute, second, millisecond));
177  }
178  return DateTime();
179 }
180 
190 inline DateTime DateTime::fromString(const std::string &str)
191 {
192  return fromString(str.data());
193 }
194 
201 inline DateTime DateTime::fromIsoStringGmt(const char *str)
202 {
203  const auto tmp = fromIsoString(str);
204  return tmp.first - tmp.second;
205 }
206 
213 inline DateTime DateTime::fromIsoStringLocal(const char *str)
214 {
215  return fromIsoString(str).first;
216 }
217 
221 constexpr inline DateTime DateTime::fromTimeStampGmt(std::time_t timeStamp)
222 {
223  return DateTime(DateTime::unixEpochStart().totalTicks() + static_cast<std::uint64_t>(timeStamp) * TimeSpan::ticksPerSecond);
224 }
225 
231 template <typename TimePoint> inline DateTime DateTime::fromChronoTimePoint(TimePoint timePoint)
232 {
233  return DateTime::fromTimeStamp(decltype(timePoint)::clock::to_time_t(timePoint));
234 }
235 
241 template <typename TimePoint> constexpr DateTime DateTime::fromChronoTimePointGmt(TimePoint timePoint)
242 {
243  return DateTime::fromTimeStampGmt(decltype(timePoint)::clock::to_time_t(timePoint));
244 }
245 
249 constexpr inline std::uint64_t &DateTime::ticks()
250 {
251  return m_ticks;
252 }
253 
257 constexpr inline std::uint64_t DateTime::totalTicks() const
258 {
259  return m_ticks;
260 }
261 
265 inline int DateTime::year() const
266 {
267  return getDatePart(DatePart::Year);
268 }
269 
273 inline int DateTime::month() const
274 {
275  return getDatePart(DatePart::Month);
276 }
277 
281 inline int DateTime::day() const
282 {
283  return getDatePart(DatePart::Day);
284 }
285 
289 inline int DateTime::dayOfYear() const
290 {
291  return getDatePart(DatePart::DayOfYear);
292 }
293 
298 constexpr inline DayOfWeek DateTime::dayOfWeek() const
299 {
300  return static_cast<DayOfWeek>((m_ticks / TimeSpan::ticksPerDay) % 7l);
301 }
302 
306 constexpr inline int DateTime::hour() const
307 {
308  return m_ticks / TimeSpan::ticksPerHour % 24ul;
309 }
310 
314 constexpr inline int DateTime::minute() const
315 {
316  return m_ticks / TimeSpan::ticksPerMinute % 60ul;
317 }
318 
322 constexpr inline int DateTime::second() const
323 {
324  return m_ticks / TimeSpan::ticksPerSecond % 60ul;
325 }
326 
330 constexpr inline int DateTime::millisecond() const
331 {
332  return m_ticks / TimeSpan::ticksPerMillisecond % 1000ul;
333 }
334 
338 constexpr inline int DateTime::microsecond() const
339 {
340  return m_ticks / TimeSpan::ticksPerMicrosecond % 1000ul;
341 }
342 
348 constexpr inline int DateTime::nanosecond() const
349 {
350  return m_ticks % 10ul * TimeSpan::nanosecondsPerTick;
351 }
352 
357 constexpr inline bool DateTime::isNull() const
358 {
359  return m_ticks == 0;
360 }
361 
365 constexpr inline TimeSpan DateTime::timeOfDay() const
366 {
367  return TimeSpan(m_ticks % TimeSpan::ticksPerDay);
368 }
369 
373 inline bool DateTime::isLeapYear() const
374 {
375  return isLeapYear(year());
376 }
377 
381 constexpr inline bool DateTime::isEternity() const
382 {
383  return m_ticks == std::numeric_limits<decltype(m_ticks)>::max();
384 }
385 
389 constexpr inline bool DateTime::isLeapYear(int year)
390 {
391  return (year % 4 != 0) ? false : ((year % 100 == 0) ? (year % 400 == 0) : true);
392 }
393 
397 inline int DateTime::daysInMonth(int year, int month)
398 {
399  return (month >= 1 && month <= 12) ? (isLeapYear(year) ? m_daysInMonth366[month - 1] : m_daysInMonth365[month - 1]) : (0);
400 }
401 
405 constexpr inline bool DateTime::isSameDay(const DateTime &other) const
406 {
407  return (m_ticks / TimeSpan::ticksPerDay) == (other.m_ticks / TimeSpan::ticksPerDay);
408 }
409 
415 inline std::string DateTime::toString(DateTimeOutputFormat format, bool noMilliseconds) const
416 {
417  std::string result;
418  toString(result, format, noMilliseconds);
419  return result;
420 }
421 
425 constexpr std::time_t DateTime::toTimeStamp() const
426 {
428 }
429 
433 constexpr inline DateTime DateTime::eternity()
434 {
435  return DateTime(std::numeric_limits<decltype(m_ticks)>::max());
436 }
437 
442 {
443  return DateTime(621355968000000000);
444 }
445 
451 {
452  return DateTime::fromTimeStamp(std::time(nullptr));
453 }
454 
460 {
461  return DateTime::fromTimeStampGmt(std::time(nullptr));
462 }
463 
467 constexpr inline bool DateTime::operator==(const DateTime &other) const
468 {
469  return m_ticks == other.m_ticks;
470 }
471 
475 constexpr inline bool DateTime::operator!=(const DateTime &other) const
476 {
477  return m_ticks != other.m_ticks;
478 }
479 
483 constexpr inline bool DateTime::operator<(const DateTime &other) const
484 {
485  return m_ticks < other.m_ticks;
486 }
487 
491 constexpr inline bool DateTime::operator>(const DateTime &other) const
492 {
493  return m_ticks > other.m_ticks;
494 }
495 
499 constexpr inline bool DateTime::operator<=(const DateTime &other) const
500 {
501  return m_ticks <= other.m_ticks;
502 }
503 
507 constexpr inline bool DateTime::operator>=(const DateTime &other) const
508 {
509  return m_ticks >= other.m_ticks;
510 }
511 
516 constexpr inline DateTime DateTime::operator+(const TimeSpan &timeSpan) const
517 {
518  return DateTime(m_ticks + timeSpan.m_ticks);
519 }
520 
525 constexpr inline DateTime DateTime::operator-(const TimeSpan &timeSpan) const
526 {
527  return DateTime(m_ticks - timeSpan.m_ticks);
528 }
529 
534 constexpr inline TimeSpan DateTime::operator+(const DateTime &other) const
535 {
536  return TimeSpan(m_ticks + other.m_ticks);
537 }
538 
545 constexpr inline TimeSpan DateTime::operator-(const DateTime &other) const
546 {
547  return TimeSpan(m_ticks - other.m_ticks);
548 }
549 
553 inline DateTime &DateTime::operator+=(const TimeSpan &timeSpan)
554 {
555  m_ticks += timeSpan.m_ticks;
556  return *this;
557 }
558 
562 inline DateTime &DateTime::operator-=(const TimeSpan &timeSpan)
563 {
564  m_ticks -= timeSpan.m_ticks;
565  return *this;
566 }
567 } // namespace CppUtilities
568 
569 namespace std {
571 template <> struct hash<CppUtilities::DateTime> {
572  inline size_t operator()(const CppUtilities::DateTime &dateTime) const
573  {
574  return hash<decltype(dateTime.totalTicks())>()(dateTime.totalTicks());
575  }
576 };
577 } // namespace std
578 
579 #endif // CHRONO_UTILITIES_DATETIME_H
CppUtilities::DateTimeOutputFormat
DateTimeOutputFormat
Specifies the output format.
Definition: datetime.h:17
CppUtilities::DateTime::toTimeStamp
constexpr std::time_t toTimeStamp() const
Returns the UNIX timestamp for the current instance.
Definition: datetime.h:425
CppUtilities::DateTime::toString
std::string toString(DateTimeOutputFormat format=DateTimeOutputFormat::DateAndTime, bool noMilliseconds=false) const
Returns the string representation of the current instance using the specified format.
Definition: datetime.h:415
CppUtilities::DateTime::fromIsoStringLocal
static DateTime fromIsoStringLocal(const char *str)
Parses the specified ISO date time denotation provided as C-style string.
Definition: datetime.h:213
CppUtilities::DateTime::DateTime
constexpr DateTime()
Constructs a DateTime.
Definition: datetime.h:137
CppUtilities::TimeSpan::ticksPerDay
static constexpr std::int64_t ticksPerDay
Definition: timespan.h:83
CppUtilities::DateTime::isEternity
constexpr bool isEternity() const
Returns whether the instance has the maximal number of ticks.
Definition: datetime.h:381
CppUtilities::DateTime::operator-
constexpr DateTime operator-(const TimeSpan &timeSpan) const
Substracts another instance.
Definition: datetime.h:525
std::hash< CppUtilities::DateTime >::operator()
size_t operator()(const CppUtilities::DateTime &dateTime) const
Definition: datetime.h:572
CppUtilities::TimeSpan::ticksPerMillisecond
static constexpr std::int64_t ticksPerMillisecond
Definition: timespan.h:79
CppUtilities::DateTime::isLeapYear
bool isLeapYear() const
Returns an indication whether the year represented by this instance is a leap year.
Definition: datetime.h:373
CppUtilities::DateTime::fromDate
static DateTime fromDate(int year=1, int month=1, int day=1)
Constructs a DateTime to the specified year, month, and day.
Definition: datetime.h:154
CppUtilities::DateTime::year
int year() const
Returns the year component of the date represented by this instance.
Definition: datetime.h:265
CppUtilities::DayOfWeek::Thursday
@ Thursday
CppUtilities::DateTime::fromTimeStampGmt
constexpr static DateTime fromTimeStampGmt(std::time_t timeStamp)
Constructs a new DateTime object with the GMT time from the specified UNIX timeStamp.
Definition: datetime.h:221
CppUtilities::operator+
CPP_UTILITIES_EXPORT DateTime operator+(DateTime begin, Period period)
Adds the specified period to the specified date.
Definition: period.cpp:60
CppUtilities::DateTime::fromChronoTimePointGmt
constexpr static DateTime fromChronoTimePointGmt(TimePoint timePoint)
CppUtilities::DateTime::operator+
constexpr DateTime operator+(const TimeSpan &timeSpan) const
Adds another instance.
Definition: datetime.h:516
CppUtilities::DateTime::eternity
static constexpr DateTime eternity()
Constructs a new instance of the DateTime class with the maximal number of ticks.
Definition: datetime.h:433
CppUtilities::DatePart::Month
@ Month
CppUtilities::DateTime::fromIsoString
static std::pair< DateTime, TimeSpan > fromIsoString(const char *str)
Parses the specified ISO date time denotation provided as C-style string.
Definition: datetime.cpp:119
CppUtilities::TimeSpan::ticksPerMicrosecond
static constexpr std::int64_t ticksPerMicrosecond
Definition: timespan.h:78
CppUtilities::DateTime::isNull
constexpr bool isNull() const
Returns ture if the date represented by the current DateTime class is null.
Definition: datetime.h:357
CppUtilities::DateTime::operator<=
constexpr bool operator<=(const DateTime &other) const
Indicates whether a specified DateTime is less or equal than another specified DateTime.
Definition: datetime.h:499
CppUtilities::DateTime::millisecond
constexpr int millisecond() const
Returns the millisecond component of the date represented by this instance.
Definition: datetime.h:330
CppUtilities::DateTime::minute
constexpr int minute() const
Returns the minute component of the date represented by this instance.
Definition: datetime.h:314
CppUtilities::DatePart::Year
@ Year
CppUtilities::DateTime::month
int month() const
Returns the month component of the date represented by this instance.
Definition: datetime.h:273
CppUtilities::max
constexpr T max(T first, T second)
Returns the greatest of the given items.
Definition: math.h:100
CppUtilities::DateTime::second
constexpr int second() const
Returns the second component of the date represented by this instance.
Definition: datetime.h:322
CppUtilities::DateTime::operator!=
constexpr bool operator!=(const DateTime &other) const
Indicates whether two DateTime instances are not equal.
Definition: datetime.h:475
CppUtilities::DateTime::isSameDay
constexpr bool isSameDay(const DateTime &other) const
Returns and indication whether two DateTime instances represent the same day.
Definition: datetime.h:405
CppUtilities::DateTime::operator>=
constexpr bool operator>=(const DateTime &other) const
Indicates whether a specified DateTime is greater or equal than another specified DateTime.
Definition: datetime.h:507
CppUtilities::DayOfWeek::Saturday
@ Saturday
CppUtilities::DateTime::operator>
constexpr bool operator>(const DateTime &other) const
Indicates whether a specified DateTime is greater than another specified DateTime.
Definition: datetime.h:491
CppUtilities::DayOfWeek::Monday
@ Monday
CppUtilities::DatePart
DatePart
Specifies the date part.
Definition: datetime.h:44
CppUtilities::DateTimeOutputFormat::DateAndTime
@ DateAndTime
CppUtilities
Contains all utilities provides by the c++utilities library.
Definition: argumentparser.h:17
CppUtilities::DateTime::operator+=
DateTime & operator+=(const TimeSpan &timeSpan)
Adds a TimeSpan to the current instance.
Definition: datetime.h:553
CppUtilities::TimeSpan::ticksPerHour
static constexpr std::int64_t ticksPerHour
Definition: timespan.h:82
CppUtilities::DateTime::gmtNow
static DateTime gmtNow()
Returns a DateTime object that is set to the current date and time on this computer,...
Definition: datetime.h:459
CppUtilities::DayOfWeek::Wednesday
@ Wednesday
CppUtilities::DateTime::operator<
constexpr bool operator<(const DateTime &other) const
Indicates whether a specified DateTime is less than another specified DateTime.
Definition: datetime.h:483
CppUtilities::DateTimeOutputFormat::DateTimeAndWeekday
@ DateTimeAndWeekday
CppUtilities::DateTime::fromTime
static DateTime fromTime(int hour=0, int minute=0, int second=0, double millisecond=0.0)
Constructs a DateTime to the specified hour, minute, second and millisecond.
Definition: datetime.h:163
CppUtilities::DateTime::fromDateAndTime
static DateTime fromDateAndTime(int year=1, int month=1, int day=1, int hour=0, int minute=0, int second=0, double millisecond=0.0)
Constructs a DateTime to the specified year, month, day, hour, minute, second and millisecond.
Definition: datetime.h:173
CppUtilities::FlagEnumClassOperations::operator+=
constexpr FlagEnumClass & operator+=(FlagEnumClass &lhs, FlagEnumClass rhs)
Definition: flagenumclass.h:64
CppUtilities::DateTime::fromChronoTimePoint
static DateTime fromChronoTimePoint(TimePoint timePoint)
Constructs a new DateTime object with the local time from the specified std::chrono::time_point.
Definition: datetime.h:231
CppUtilities::DateTime::dayOfWeek
constexpr DayOfWeek dayOfWeek() const
Returns the day of the week represented by this instance.
Definition: datetime.h:298
CppUtilities::DateTime::nanosecond
constexpr int nanosecond() const
Returns the nanosecond component of the date represented by this instance.
Definition: datetime.h:348
CppUtilities::FlagEnumClassOperations::operator-=
constexpr FlagEnumClass & operator-=(FlagEnumClass &lhs, FlagEnumClass rhs)
Definition: flagenumclass.h:71
CppUtilities::DayOfWeek::Tuesday
@ Tuesday
CppUtilities::DateTime::now
static DateTime now()
Returns a DateTime object that is set to the current date and time on this computer,...
Definition: datetime.h:450
CppUtilities::DayOfWeek::Sunday
@ Sunday
CppUtilities::DayOfWeek
DayOfWeek
Specifies the day of the week.
Definition: datetime.h:29
CppUtilities::DateTime::dayOfYear
int dayOfYear() const
Returns the day of the year represented by this instance.
Definition: datetime.h:289
CppUtilities::DateTime::ticks
constexpr std::uint64_t & ticks()
Returns a mutable reference to the total ticks.
Definition: datetime.h:249
CppUtilities::DateTimeOutputFormat::TimeOnly
@ TimeOnly
CppUtilities::DatePart::DayOfYear
@ DayOfYear
CppUtilities::TimeSpan
Represents a time interval.
Definition: timespan.h:25
CppUtilities::DateTime::fromTimeStamp
static DateTime fromTimeStamp(std::time_t timeStamp)
Constructs a new DateTime object with the local time from the specified UNIX timeStamp.
Definition: datetime.cpp:59
CppUtilities::TimeSpan::nanosecondsPerTick
static constexpr std::int64_t nanosecondsPerTick
Definition: timespan.h:77
CppUtilities::DateTimeOutputFormat::DateTimeAndShortWeekday
@ DateTimeAndShortWeekday
CppUtilities::DateTime::unixEpochStart
static constexpr DateTime unixEpochStart()
Returns the DateTime object for the "1970-01-01T00:00:00Z".
Definition: datetime.h:441
CppUtilities::DateTime::fromIsoStringGmt
static DateTime fromIsoStringGmt(const char *str)
Parses the specified ISO date time denotation provided as C-style string.
Definition: datetime.h:201
CppUtilities::DateTime::microsecond
constexpr int microsecond() const
Returns the microsecond component of the date represented by this instance.
Definition: datetime.h:338
CppUtilities::DateTime::operator==
constexpr bool operator==(const DateTime &other) const
Indicates whether two DateTime instances are equal.
Definition: datetime.h:467
CppUtilities::DateTime
Represents an instant in time, typically expressed as a date and time of day.
Definition: datetime.h:51
CppUtilities::TimeSpan::ticksPerSecond
static constexpr std::int64_t ticksPerSecond
Definition: timespan.h:80
CppUtilities::DatePart::Day
@ Day
CppUtilities::DayOfWeek::Friday
@ Friday
CPP_UTILITIES_EXPORT
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
CppUtilities::DateTime::daysInMonth
static int daysInMonth(int year, int month)
Returns the number of days in the specified month and year.
Definition: datetime.h:397
CppUtilities::operator==
bool operator==(const AsHexNumber< T > &lhs, const AsHexNumber< T > &rhs)
Provides operator == required by CPPUNIT_ASSERT_EQUAL.
Definition: testutils.h:203
CppUtilities::DateTime::operator-=
DateTime & operator-=(const TimeSpan &timeSpan)
Substracts a TimeSpan from the current instance.
Definition: datetime.h:562
CppUtilities::TimeSpan::ticksPerMinute
static constexpr std::int64_t ticksPerMinute
Definition: timespan.h:81
CppUtilities::DateTime::day
int day() const
Returns the day component of the date represented by this instance.
Definition: datetime.h:281
CppUtilities::DateTime::fromString
static DateTime fromString(const std::string &str)
Parses the given std::string as DateTime.
Definition: datetime.h:190
timespan.h
CppUtilities::DateTime::timeOfDay
constexpr TimeSpan timeOfDay() const
Returns the time of day as TimeSpan for this instance.
Definition: datetime.h:365
CppUtilities::DateTime::totalTicks
constexpr std::uint64_t totalTicks() const
Returns the number of ticks which represent the value of the current instance.
Definition: datetime.h:257
CppUtilities::DateTimeOutputFormat::DateOnly
@ DateOnly
CppUtilities::DateTime::hour
constexpr int hour() const
Returns the hour component of the date represented by this instance.
Definition: datetime.h:306