An implementation of the Gregorian calendar. More...
#include <gregorian_calendar.hpp>
Public Types | |
typedef ymd_type_ | ymd_type |
define a type a date split into components More... | |
typedef ymd_type::month_type | month_type |
define a type for representing months More... | |
typedef ymd_type::day_type | day_type |
define a type for representing days More... | |
typedef ymd_type::year_type | year_type |
Type to hold a stand alone year value (eg: 2002) More... | |
typedef date_int_type_ | date_int_type |
Define the integer type to use for internal calculations. More... | |
Static Public Member Functions | |
static unsigned short | day_of_week (const ymd_type &ymd) |
Return the day of the week (0==Sunday, 1==Monday, etc) More... | |
static int | week_number (const ymd_type &ymd) |
Return the iso week number for the date. More... | |
static date_int_type | day_number (const ymd_type &ymd) |
Convert a ymd_type into a day number. More... | |
static date_int_type | julian_day_number (const ymd_type &ymd) |
Convert a year-month-day into the julian day number. More... | |
static date_int_type | modjulian_day_number (const ymd_type &ymd) |
Convert year-month-day into a modified julian day number. More... | |
static ymd_type | from_day_number (date_int_type) |
Change a day number into a year-month-day. More... | |
static ymd_type | from_julian_day_number (date_int_type) |
Change a day number into a year-month-day. More... | |
static ymd_type | from_modjulian_day_number (date_int_type) |
Change a modified julian day number into a year-month-day. More... | |
static bool | is_leap_year (year_type) |
Determine if the provided year is a leap year. More... | |
static unsigned short | end_of_month_day (year_type y, month_type m) |
Calculate the last day of the month. More... | |
static ymd_type | epoch () |
Provide the ymd_type specification for the calandar start. More... | |
static unsigned short | days_in_week () |
Defines length of a week for week calculations. More... | |
An implementation of the Gregorian calendar.
This is a parameterized implementation of a proleptic Gregorian Calendar that can be used in the creation of date systems or just to perform calculations. All the methods of this class are static functions, so the intent is to never create instances of this class.
ymd_type_ | Struct type representing the year, month, day. The ymd_type must define a of types for the year, month, and day. These types need to be arithmetic types. |
date_int_type_ | Underlying type for the date count. Must be an arithmetic type. |
typedef date_int_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::date_int_type |
Define the integer type to use for internal calculations.
typedef ymd_type::day_type boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::day_type |
define a type for representing days
typedef ymd_type::month_type boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::month_type |
define a type for representing months
typedef ymd_type::year_type boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::year_type |
Type to hold a stand alone year value (eg: 2002)
typedef ymd_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::ymd_type |
define a type a date split into components
|
inlinestatic |
Convert a ymd_type into a day number.
The day number is an absolute number of days since the start of count
References boost::a, and boost::polygon::y().
|
inlinestatic |
Return the day of the week (0==Sunday, 1==Monday, etc)
Converts a year-month-day into a day of the week number
References boost::a, and boost::polygon::y().
|
inlinestatic |
Defines length of a week for week calculations.
|
inlinestatic |
Calculate the last day of the month.
Find the day which is the end of the month given year and month No error checking is performed.
|
inlinestatic |
Provide the ymd_type specification for the calandar start.
|
inlinestatic |
Change a day number into a year-month-day.
References boost::a, boost::asio::b, boost::multiprecision::backends::c, boost::date_time::day, boost::locale::period::marks::month, and boost::date_time::year.
|
inlinestatic |
Change a day number into a year-month-day.
References boost::a, boost::asio::b, boost::multiprecision::backends::c, boost::date_time::day, boost::locale::period::marks::month, and boost::date_time::year.
|
inlinestatic |
Change a modified julian day number into a year-month-day.
|
inlinestatic |
Determine if the provided year is a leap year.
|
inlinestatic |
Convert a year-month-day into the julian day number.
Since this implementation uses julian day internally, this is the same as the day_number.
|
inlinestatic |
Convert year-month-day into a modified julian day number.
The day number is an absolute number of days. MJD 0 thus started on 17 Nov 1858(Gregorian) at 00:00:00 UTC
|
inlinestatic |
Return the iso week number for the date.
Implements the rules associated with the iso 8601 week number. Basically the rule is that Week 1 of the year is the week that contains January 4th or the week that contains the first Thursday in January. Reference for this algorithm is the Calendar FAQ by Claus Tondering, April 2000.
References boost::date_time::day, and boost::date_time::week.