Boost.Locale
date_time.hpp
1//
2// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3//
4// Distributed under the Boost Software License, Version 1.0.
5// https://www.boost.org/LICENSE_1_0.txt
6
7#ifndef BOOST_LOCALE_DATE_TIME_HPP_INCLUDED
8#define BOOST_LOCALE_DATE_TIME_HPP_INCLUDED
9
10#include <boost/locale/date_time_facet.hpp>
11#include <boost/locale/formatting.hpp>
12#include <boost/locale/hold_ptr.hpp>
13#include <boost/locale/time_zone.hpp>
14#include <locale>
15#include <stdexcept>
16#include <vector>
17
18#ifdef BOOST_MSVC
19# pragma warning(push)
20# pragma warning(disable : 4275 4251 4231 4660)
21#endif
22
23namespace boost { namespace locale {
28
30 class BOOST_SYMBOL_VISIBLE date_time_error : public std::runtime_error {
31 public:
33 date_time_error(const std::string& e) : std::runtime_error(e) {}
34 };
35
44 int value;
46 date_time_period operator+() const { return *this; }
49
52 };
53
54 namespace period {
57 {
59 }
62 {
63 return period_type(marks::era);
64 }
67 {
69 }
72 {
74 }
77 {
79 }
82 {
83 return period_type(marks::day);
84 }
87 {
89 }
97 {
99 }
103 {
105 }
108 {
110 }
113 {
114 return period_type(marks::hour);
115 }
118 {
120 }
123 {
125 }
128 {
130 }
133 {
135 }
138 {
140 }
143 {
145 }
148 {
150 }
151
153 inline date_time_period era(int v)
154 {
155 return date_time_period(era(), v);
156 }
158 inline date_time_period year(int v)
159 {
160 return date_time_period(year(), v);
161 }
164 {
165 return date_time_period(extended_year(), v);
166 }
169 {
170 return date_time_period(month(), v);
171 }
173 inline date_time_period day(int v)
174 {
175 return date_time_period(day(), v);
176 }
179 {
180 return date_time_period(day_of_year(), v);
181 }
189 {
190 return date_time_period(day_of_week(), v);
191 }
195 {
197 }
200 {
202 }
204 inline date_time_period hour(int v)
205 {
206 return date_time_period(hour(), v);
207 }
210 {
211 return date_time_period(hour_12(), v);
212 }
215 {
216 return date_time_period(am_pm(), v);
217 }
220 {
221 return date_time_period(minute(), v);
222 }
225 {
226 return date_time_period(second(), v);
227 }
230 {
231 return date_time_period(week_of_year(), v);
232 }
235 {
236 return date_time_period(week_of_month(), v);
237 }
240 {
242 }
243
246 {
247 return date_time_period(month(), 0);
248 }
251 {
252 return date_time_period(month(), 1);
253 }
256 {
257 return date_time_period(month(), 2);
258 }
261 {
262 return date_time_period(month(), 3);
263 }
266 {
267 return date_time_period(month(), 4);
268 }
271 {
272 return date_time_period(month(), 5);
273 }
276 {
277 return date_time_period(month(), 6);
278 }
281 {
282 return date_time_period(month(), 7);
283 }
286 {
287 return date_time_period(month(), 8);
288 }
291 {
292 return date_time_period(month(), 9);
293 }
296 {
297 return date_time_period(month(), 10);
298 }
301 {
302 return date_time_period(month(), 11);
303 }
304
307 {
308 return date_time_period(day_of_week(), 1);
309 }
312 {
313 return date_time_period(day_of_week(), 2);
314 }
317 {
318 return date_time_period(day_of_week(), 3);
319 }
322 {
323 return date_time_period(day_of_week(), 4);
324 }
327 {
328 return date_time_period(day_of_week(), 5);
329 }
332 {
333 return date_time_period(day_of_week(), 6);
334 }
337 {
338 return date_time_period(day_of_week(), 7);
339 }
342 {
343 return date_time_period(am_pm(), 0);
344 }
347 {
348 return date_time_period(am_pm(), 1);
349 }
350
353 {
354 return date_time_period(f);
355 }
358 {
359 return date_time_period(f, -1);
360 }
361
363 template<typename T>
365 {
366 return date_time_period(f, v);
367 }
368
370 template<typename T>
372 {
373 return date_time_period(f, v);
374 }
376 template<typename T>
378 {
379 return date_time_period(f.type, f.value * v);
380 }
381
383 template<typename T>
385 {
386 return date_time_period(f.type, f.value * v);
387 }
388
389 } // namespace period
390
396 public:
399
402
404 date_time_period_set(const date_time_period& fl) { basic_[0] = fl; }
405
408 {
409 size_t n = size();
410 if(n < 4)
411 basic_[n] = f;
412 else
413 periods_.push_back(f);
414 }
415
417 size_t size() const
418 {
419 if(basic_[0].type == period::period_type())
420 return 0;
421 if(basic_[1].type == period::period_type())
422 return 1;
423 if(basic_[2].type == period::period_type())
424 return 2;
425 if(basic_[3].type == period::period_type())
426 return 3;
427 return 4 + periods_.size();
428 }
429
431 const date_time_period& operator[](size_t n) const
432 {
433 if(n >= size())
434 throw std::out_of_range("Invalid index to date_time_period");
435 if(n < 4)
436 return basic_[n];
437 else
438 return periods_[n - 4];
439 }
440
441 private:
442 date_time_period basic_[4];
443 std::vector<date_time_period> periods_;
444 };
445
448 {
450 for(unsigned i = 0; i < b.size(); i++)
451 s.add(b[i]);
452 return s;
453 }
454
457 {
459 for(unsigned i = 0; i < b.size(); i++)
460 s.add(-b[i]);
461 return s;
462 }
463
469 class BOOST_LOCALE_DECL calendar {
470 public:
475 calendar(std::ios_base& ios);
476
480 calendar(const std::locale& l, const std::string& zone);
481
485 calendar(const std::locale& l);
486
490
491 calendar(const std::string& zone);
492
497 ~calendar();
498
500 calendar(const calendar& other);
503
513
515 int first_day_of_week() const;
516
518 const std::locale& get_locale() const;
520 const std::string& get_time_zone() const;
521
523 bool is_gregorian() const;
524
526 bool operator==(const calendar& other) const;
528 bool operator!=(const calendar& other) const;
529
530 private:
531 friend class date_time;
532 std::locale locale_;
533 std::string tz_;
535 };
536
560
561 class BOOST_LOCALE_DECL date_time {
562 public:
567
569 date_time(const date_time& other);
570 // Move construct a date_time
571 date_time(date_time&&) noexcept = default;
572
574 date_time(const date_time& other, const date_time_period_set& set);
575
577 date_time& operator=(const date_time& other);
578 // Move assign a date_time
579 date_time& operator=(date_time&&) noexcept = default;
580
584 date_time(double time);
585
587 date_time(double time, const calendar& cal);
588
590 date_time(const calendar& cal);
591
596
598 date_time(const date_time_period_set& set, const calendar& cal);
599
601 date_time& operator=(const date_time_period_set& f);
602
604 void set(period::period_type f, int v);
605
607 int get(period::period_type f) const;
609 int operator/(period::period_type f) const { return get(f); }
610
619
628
637
646
655
664
668 double time() const;
673 void time(double v);
674
676 std::string timezone() const;
677
679 bool operator==(const date_time& other) const;
681 bool operator!=(const date_time& other) const;
683 bool operator<(const date_time& other) const;
685 bool operator>(const date_time& other) const;
687 bool operator<=(const date_time& other) const;
689 bool operator>=(const date_time& other) const;
690
692 void swap(date_time& other) noexcept;
693
695 int difference(const date_time& other, period::period_type f) const;
696
702
705
706 private:
708 };
709
721 template<typename CharType>
722 std::basic_ostream<CharType>& operator<<(std::basic_ostream<CharType>& out, const date_time& t)
723 {
724 double time_point = t.time();
725 uint64_t display_flags = ios_info::get(out).display_flags();
726 if(display_flags == flags::date || display_flags == flags::time || display_flags == flags::datetime
727 || display_flags == flags::strftime)
728 {
729 out << time_point;
730 } else {
731 ios_info::get(out).display_flags(flags::datetime);
732 out << time_point;
733 ios_info::get(out).display_flags(display_flags);
734 }
735 return out;
736 }
737
741 template<typename CharType>
742 std::basic_istream<CharType>& operator>>(std::basic_istream<CharType>& in, date_time& t)
743 {
744 double v;
745 uint64_t display_flags = ios_info::get(in).display_flags();
746 if(display_flags == flags::date || display_flags == flags::time || display_flags == flags::datetime
747 || display_flags == flags::strftime)
748 {
749 in >> v;
750 } else {
751 ios_info::get(in).display_flags(flags::datetime);
752 in >> v;
753 ios_info::get(in).display_flags(display_flags);
754 }
755 if(!in.fail())
756 t.time(v);
757 return in;
758 }
759
760#ifdef BOOST_MSVC
761# pragma warning(push)
762# pragma warning(disable : 4512) // assignment operator could not be generated
763#endif
764
772 public:
775 date_time_duration(const date_time& first, const date_time& second) : s_(first), e_(second) {}
776
778 int get(period::period_type f) const { return start().difference(end(), f); }
780 int operator/(period::period_type f) const { return start().difference(end(), f); }
781
783 const date_time& start() const { return s_; }
785 const date_time& end() const { return e_; }
786
787 private:
788 const date_time& s_;
789 const date_time& e_;
790 };
791#ifdef BOOST_MSVC
792# pragma warning(pop)
793#endif
794
797 inline date_time_duration operator-(const date_time& later, const date_time& earlier)
798 {
799 return date_time_duration(earlier, later);
800 }
801
802 namespace period {
804 inline int era(const date_time& dt)
805 {
806 return dt.get(era());
807 }
810 inline int year(const date_time& dt)
811 {
812 return dt.get(year());
813 }
816 inline int extended_year(const date_time& dt)
817 {
818 return dt.get(extended_year());
819 }
821 inline int month(const date_time& dt)
822 {
823 return dt.get(month());
824 }
826 inline int day(const date_time& dt)
827 {
828 return dt.get(day());
829 }
831 inline int day_of_year(const date_time& dt)
832 {
833 return dt.get(day_of_year());
834 }
841 inline int day_of_week(const date_time& dt)
842 {
843 return dt.get(day_of_week());
844 }
848 inline int day_of_week_in_month(const date_time& dt)
849 {
850 return dt.get(day_of_week_in_month());
851 }
854 inline int day_of_week_local(const date_time& dt)
855 {
856 return dt.get(day_of_week_local());
857 }
859 inline int hour(const date_time& dt)
860 {
861 return dt.get(hour());
862 }
864 inline int hour_12(const date_time& dt)
865 {
866 return dt.get(hour_12());
867 }
869 inline int am_pm(const date_time& dt)
870 {
871 return dt.get(am_pm());
872 }
874 inline int minute(const date_time& dt)
875 {
876 return dt.get(minute());
877 }
879 inline int second(const date_time& dt)
880 {
881 return dt.get(second());
882 }
884 inline int week_of_year(const date_time& dt)
885 {
886 return dt.get(week_of_year());
887 }
889 inline int week_of_month(const date_time& dt)
890 {
891 return dt.get(week_of_month());
892 }
895 inline int first_day_of_week(const date_time& dt)
896 {
897 return dt.get(first_day_of_week());
898 }
899
902 inline int era(const date_time_duration& dt)
903 {
904 return dt.get(era());
905 }
907 inline int year(const date_time_duration& dt)
908 {
909 return dt.get(year());
910 }
913 inline int extended_year(const date_time_duration& dt)
914 {
915 return dt.get(extended_year());
916 }
918 inline int month(const date_time_duration& dt)
919 {
920 return dt.get(month());
921 }
923 inline int day(const date_time_duration& dt)
924 {
925 return dt.get(day());
926 }
928 inline int day_of_year(const date_time_duration& dt)
929 {
930 return dt.get(day_of_year());
931 }
933 inline int day_of_week(const date_time_duration& dt)
934 {
935 return dt.get(day_of_week());
936 }
940 {
941 return dt.get(day_of_week_in_month());
942 }
945 {
946 return dt.get(day_of_week_local());
947 }
949 inline int hour(const date_time_duration& dt)
950 {
951 return dt.get(hour());
952 }
954 inline int hour_12(const date_time_duration& dt)
955 {
956 return dt.get(hour_12());
957 }
959 inline int am_pm(const date_time_duration& dt)
960 {
961 return dt.get(am_pm());
962 }
964 inline int minute(const date_time_duration& dt)
965 {
966 return dt.get(minute());
967 }
969 inline int second(const date_time_duration& dt)
970 {
971 return dt.get(second());
972 }
974 inline int week_of_year(const date_time_duration& dt)
975 {
976 return dt.get(week_of_year());
977 }
979 inline int week_of_month(const date_time_duration& dt)
980 {
981 return dt.get(week_of_month());
982 }
985 {
986 return dt.get(first_day_of_week());
987 }
988
989 } // namespace period
990
992
993}} // namespace boost::locale
994
995#ifdef BOOST_MSVC
996# pragma warning(pop)
997#endif
998
1004
1005#endif
this class provides an access to general calendar information.
Definition: date_time.hpp:469
const std::string & get_time_zone() const
get calendar's time zone
calendar(const std::string &zone)
int greatest_minimum(period::period_type f) const
int maximum(period::period_type f) const
Get maximum value for period f, For example for Gregorian calendar's maximum period::day it is 31.
calendar & operator=(const calendar &other)
assign calendar
bool is_gregorian() const
Check if the calendar is Gregorian.
int least_maximum(period::period_type f) const
Get least maximum value for period f, For example for Gregorian calendar's maximum period::day it is ...
bool operator==(const calendar &other) const
Compare calendars for equivalence: i.e. calendar types, time zones etc.
int first_day_of_week() const
Get first day of week for specific calendar, for example for US it is 1 - Sunday for France it is 2 -...
int minimum(period::period_type f) const
Get minimum value for period f, For example for period::day it is 1.
calendar(std::ios_base &ios)
calendar(const std::locale &l)
calendar(const calendar &other)
copy calendar
bool operator!=(const calendar &other) const
Opposite of ==.
calendar(const std::locale &l, const std::string &zone)
const std::locale & get_locale() const
get calendar's locale
This class represents a period: a pair of two date_time objects.
Definition: date_time.hpp:771
const date_time & start() const
Get starting point.
Definition: date_time.hpp:783
date_time_duration(const date_time &first, const date_time &second)
Definition: date_time.hpp:775
const date_time & end() const
Get ending point.
Definition: date_time.hpp:785
int operator/(period::period_type f) const
Syntactic sugar for get(f)
Definition: date_time.hpp:780
int get(period::period_type f) const
find a difference in terms of period_type f
Definition: date_time.hpp:778
This error is thrown in case of invalid state that occurred.
Definition: date_time.hpp:30
date_time_error(const std::string &e)
Constructor of date_time_error class.
Definition: date_time.hpp:33
this class that represents a set of periods,
Definition: date_time.hpp:395
date_time_period_set(period::period_type f)
Create a set of single period with value 1.
Definition: date_time.hpp:401
void add(date_time_period f)
Append date_time_period f to the set.
Definition: date_time.hpp:407
size_t size() const
Get number if items in list.
Definition: date_time.hpp:417
date_time_period_set(const date_time_period &fl)
Create a set of single period fl.
Definition: date_time.hpp:404
date_time_period_set()
Default constructor - empty set.
Definition: date_time.hpp:398
const date_time_period & operator[](size_t n) const
Get item at position n the set, n should be in range [0,size)
Definition: date_time.hpp:431
this class represents a date time and allows to perform various operation according to the locale set...
Definition: date_time.hpp:561
date_time operator-(const date_time_period &v) const
subtract date_time_period from the current date_time
bool operator>(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time & operator-=(const date_time_period_set &v)
subtract date_time_period_set v from the current date_time
date_time & operator-=(const date_time_period &v)
subtract date_time_period from the current date_time
date_time & operator+=(const date_time_period_set &v)
add date_time_period_set v to the current date_time
date_time operator+(period::period_type f) const
add single period f to the current date_time
Definition: date_time.hpp:612
date_time & operator>>=(const date_time_period &v)
roll current date_time backward by date_time_period v
date_time operator>>(const date_time_period_set &v) const
roll current date_time backward by date_time_period_set v
bool operator<=(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time(const date_time &other)
Copy a date_time.
std::string timezone() const
Get the name of the associated timezone.
bool is_in_daylight_saving_time() const
Check if *this time point is in daylight saving time.
date_time operator+(const date_time_period &v) const
add date_time_period to the current date_time
date_time operator>>(period::period_type f) const
roll backward a date by single period f.
Definition: date_time.hpp:623
bool operator<(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
int difference(const date_time &other, period::period_type f) const
calculate the distance from this date_time to other in terms of periods f
date_time operator+(const date_time_period_set &v) const
add date_time_period_set v to the current date_time
date_time & operator<<=(const date_time_period &v)
roll current date_time forward by date_time_period v
bool operator!=(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time operator>>(const date_time_period &v) const
roll current date_time backward by date_time_period v
date_time operator<<(const date_time_period_set &v) const
roll current date_time forward by date_time_period_set v
date_time & operator-=(period::period_type f)
subtract single period f from the current date_time
Definition: date_time.hpp:618
int get(period::period_type f) const
get specific period f value
bool operator>=(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time operator<<(period::period_type f) const
roll forward a date by single period f.
Definition: date_time.hpp:621
int minimum(period::period_type f) const
Get minimal possible value for *this time point for a period f.
date_time & operator+=(const date_time_period &v)
add date_time_period to the current date_time
int maximum(period::period_type f) const
date_time & operator>>=(const date_time_period_set &v)
roll current date_time backward by date_time_period_set v
bool operator==(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time & operator+=(period::period_type f)
add single period f to the current date_time
Definition: date_time.hpp:616
date_time & operator<<=(period::period_type f)
roll forward a date by single period f.
Definition: date_time.hpp:625
date_time & operator>>=(period::period_type f)
roll backward a date by single period f.
Definition: date_time.hpp:627
void swap(date_time &other) noexcept
swaps two dates - efficient, does not throw
date_time operator-(period::period_type f) const
subtract single period f from the current date_time
Definition: date_time.hpp:614
date_time operator-(const date_time_period_set &v) const
subtract date_time_period_set v from the current date_time
date_time & operator<<=(const date_time_period_set &v)
roll current date_time forward by date_time_period_set v
date_time operator<<(const date_time_period &v) const
roll current date_time forward by date_time_period v
a smart pointer similar to std::unique_ptr but the underlying object has the same constness as the po...
Definition: hold_ptr.hpp:17
void display_flags(uint64_t flags)
Set flags that define how to format data, e.g. number, spell, currency etc.
static ios_info & get(std::ios_base &ios)
Get ios_info instance for specific stream object.
This class holds a type that represents certain period of time like year, hour, second and so on.
Definition: date_time_facet.hpp:66
date_time_period_set operator-(const date_time_period_set &a, const date_time_period_set &b)
Append two period sets when all periods of set change their sign.
Definition: date_time.hpp:456
date_time_period_set operator+(const date_time_period_set &a, const date_time_period_set &b)
Append two periods sets. Note this operator is not commutative.
Definition: date_time.hpp:447
std::basic_ostream< CharType > & operator<<(std::basic_ostream< CharType > &out, const date_time &t)
Definition: date_time.hpp:722
std::basic_istream< CharType > & operator>>(std::basic_istream< CharType > &in, date_time &t)
Definition: date_time.hpp:742
@ day_of_week_local
Local day of week, for example in France Monday is 1, in US Sunday is 1, [1..7].
Definition: date_time_facet.hpp:44
@ month
The month of year, calendar specific, in Gregorian [0..11].
Definition: date_time_facet.hpp:34
@ minute
minute [0..59]
Definition: date_time_facet.hpp:48
@ hour_12
12 clock hour [0..11]
Definition: date_time_facet.hpp:46
@ second
second [0..59]
Definition: date_time_facet.hpp:49
@ year
Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition: date_time_facet.hpp:32
@ day_of_year
The number of day in year, starting from 1, in Gregorian [1..366].
Definition: date_time_facet.hpp:36
@ week_of_year
The week number in the year.
Definition: date_time_facet.hpp:50
@ extended_year
Extended year for Gregorian/Julian calendars, where 1 BC == 0, 2 BC == -1.
Definition: date_time_facet.hpp:33
@ hour
24 clock hour [0..23]
Definition: date_time_facet.hpp:45
@ am_pm
am or pm marker [0..1]
Definition: date_time_facet.hpp:47
@ first_day_of_week
First day of week, constant, for example Sunday in US = 1, Monday in France = 2.
Definition: date_time_facet.hpp:52
@ week_of_month
The week number within current month.
Definition: date_time_facet.hpp:51
@ invalid
Special invalid value, should not be used directly.
Definition: date_time_facet.hpp:30
@ day
The day of month, calendar specific, in Gregorian [1..31].
Definition: date_time_facet.hpp:35
@ era
Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1].
Definition: date_time_facet.hpp:31
@ day_of_week_in_month
Definition: date_time_facet.hpp:42
@ day_of_week
Definition: date_time_facet.hpp:37
period_type minute()
Get period_type for: minute [0..59].
Definition: date_time.hpp:127
period_type day_of_week_in_month()
Definition: date_time.hpp:102
date_time_period sunday()
Get predefined constant for Sunday.
Definition: date_time.hpp:306
date_time_period operator+(period::period_type f)
convert period_type to date_time_period(f,1)
Definition: date_time.hpp:352
period_type first_day_of_week()
Get period_type for: First day of week, constant, for example Sunday in US = 1, Monday in France = 2.
Definition: date_time.hpp:147
date_time_period april()
Get predefined constant for April.
Definition: date_time.hpp:260
date_time_period tuesday()
Get predefined constant for Tuesday.
Definition: date_time.hpp:316
date_time_period friday()
Get predefined constant for Friday.
Definition: date_time.hpp:331
period_type day_of_year()
Get period_type for: The number of day in year, starting from 1, in Gregorian [1.....
Definition: date_time.hpp:86
period_type hour()
Get period_type for: 24 clock hour [0..23].
Definition: date_time.hpp:112
date_time_period july()
Get predefined constant for July.
Definition: date_time.hpp:275
date_time_period may()
Get predefined constant for May.
Definition: date_time.hpp:265
date_time_period monday()
Get predefined constant for Monday.
Definition: date_time.hpp:311
period_type week_of_year()
Get period_type for: The week number in the year.
Definition: date_time.hpp:137
period_type day_of_week_local()
Get period_type for: Local day of week, for example in France Monday is 1, in US Sunday is 1,...
Definition: date_time.hpp:107
date_time_period pm()
Get predefined constant for PM (Post Meridiem)
Definition: date_time.hpp:346
date_time_period january()
Get predefined constant for January.
Definition: date_time.hpp:245
period_type am_pm()
Get period_type for: am or pm marker [0..1].
Definition: date_time.hpp:122
period_type era()
Get period_type for: Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1].
Definition: date_time.hpp:61
period_type invalid()
Get period_type for: special invalid value, should not be used directly.
Definition: date_time.hpp:56
date_time_period am()
Get predefined constant for AM (Ante Meridiem)
Definition: date_time.hpp:341
period_type day()
Get period_type for: The day of month, calendar specific, in Gregorian [1..31].
Definition: date_time.hpp:81
date_time_period wednesday()
Get predefined constant for Wednesday.
Definition: date_time.hpp:321
date_time_period operator-(period::period_type f)
convert period_type to date_time_period(f,-1)
Definition: date_time.hpp:357
period_type year()
Get period_type for: Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition: date_time.hpp:66
period_type month()
Get period_type for: The month of year, calendar specific, in Gregorian [0..11].
Definition: date_time.hpp:76
date_time_period december()
Get predefined constant for December.
Definition: date_time.hpp:300
period_type week_of_month()
Get period_type for: The week number within current month.
Definition: date_time.hpp:142
date_time_period thursday()
Get predefined constant for Thursday.
Definition: date_time.hpp:326
date_time_period february()
Get predefined constant for February.
Definition: date_time.hpp:250
date_time_period november()
Get predefined constant for November.
Definition: date_time.hpp:295
date_time_period august()
Get predefined constant for August.
Definition: date_time.hpp:280
date_time_period june()
Get predefined constant for June.
Definition: date_time.hpp:270
date_time_period march()
Get predefined constant for March.
Definition: date_time.hpp:255
date_time_period saturday()
Get predefined constant for Saturday.
Definition: date_time.hpp:336
period_type day_of_week()
Definition: date_time.hpp:96
date_time_period october()
Get predefined constant for October.
Definition: date_time.hpp:290
date_time_period september()
Get predefined constant for September.
Definition: date_time.hpp:285
date_time_period operator*(period::period_type f, T v)
Create date_time_period of type f with value v.
Definition: date_time.hpp:364
period_type second()
Get period_type for: second [0..59].
Definition: date_time.hpp:132
period_type extended_year()
Get period_type for: Extended year for Gregorian/Julian calendars, where 1 BC == 0,...
Definition: date_time.hpp:71
period_type hour_12()
Get period_type for: 12 clock hour [0..11].
Definition: date_time.hpp:117
This class represents a pair of period_type and the integer values that describes its amount....
Definition: date_time.hpp:42
date_time_period operator-() const
Operator -, switches the sign of period.
Definition: date_time.hpp:48
date_time_period operator+() const
Operator + returns copy of itself.
Definition: date_time.hpp:46
date_time_period(period::period_type f=period::period_type(), int v=1)
Constructor that creates date_time_period from period_type f and a value v – default 1.
Definition: date_time.hpp:51
period::period_type type
The type of period, i.e. era, year, day etc.
Definition: date_time.hpp:43
int value
Definition: date_time.hpp:44