1<?xml version="1.0" encoding="utf-8"?>
2<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
3"../../../tools/boostbook/dtd/boostbook.dtd">
4
5<!-- Copyright (c) 2001-2005 CrystalClear Software, Inc.
6     Subject to the Boost Software License, Version 1.0.
7     (See accompanying file LICENSE_1_0.txt or  http://www.boost.org/LICENSE_1_0.txt)
8-->
9
10<section id="date_time.gregorian.gregorian_calendar">
11  <title>Gregorian Calendar</title>
12
13  <link linkend="gregcal_intro">Introduction</link> --
14  <link linkend="gregcal_header">Header</link> --
15  <link linkend="gregcal_functions">Functions</link>
16
17  <anchor id="gregcal_intro" />
18  <bridgehead renderas="sect3">Introduction</bridgehead>
19  <para>
20    The class boost::gregorian::gregorian_calendar implements the functions necessary to create the gregorian date system. It converts to the year-month-day form of a date to a day number representation and back.
21  </para>
22  <para>
23    For most purposes this class is simply accessed by <link linkend="date_time.gregorian.date_class">gregorian::date</link> and is not used directly by the user. However, there are useful functions that might be of use such as the end_of_month_day function.
24  </para>
25  <para>
26    The <link linkend="date_time.examples.print_month">print month</link> example demonstrates this.
27  </para>
28
29  <anchor id="gregcal_header" />
30  <bridgehead renderas="sect3">Header</bridgehead>
31  <para>
32    <programlisting>#include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o
33or
34#include "boost/date_time/gregorian/gregorian_types.hpp" //no i/o just types</programlisting>
35  </para>
36
37  <anchor id="gregcal_functions" />
38  <bridgehead renderas="sect3">Functions</bridgehead>
39  <informaltable frame="all">
40    <tgroup cols="2">
41      <thead>
42	<row>
43	  <entry valign="top" morerows="1">Syntax</entry>
44	  <entry>Description</entry>
45	</row>
46	<row>
47	  <entry>Example</entry>
48	</row>
49      </thead>
50      <tbody>
51        <row>
52	  <entry valign="top" morerows="1"><screen>static short day_of_week(ymd_type)</screen></entry>
53	  <entry>Return the day of the week (0==Sunday, 1==Monday, etc)</entry>
54	</row>
55	<row>
56	  <entry>See also <link linkend="date_time.gregorian.date_class">gregorian::date</link> day_of_week</entry>
57        </row>
58
59	<row>
60	  <entry valign="top" morerows="1"><screen>static date_int_type day_number(ymd_type)</screen></entry>
61	  <entry> Convert a ymd_type into a day number. The day number is an absolute number of days since the epoch start.</entry>
62	</row>
63	<row>
64	  <entry></entry>
65        </row>
66
67	<row>
68          <entry valign="top" morerows="1"><screen>static short end_of_month_day(year_type,
69                              month_type)</screen></entry>
70	  <entry>Given a year and month determine the last day of the month.</entry>
71	</row>
72	<row>
73	  <entry></entry>
74        </row>
75
76	<row>
77	  <entry valign="top" morerows="1"><screen>static ymd_type from_day_number(date_int_type)</screen></entry>
78	  <entry> Convert a day number to a ymd struct.</entry>
79	</row>
80	<row>
81	  <entry></entry>
82        </row>
83
84	<row>
85	  <entry valign="top" morerows="1"><screen>static bool is_leap_year(year_type)</screen></entry>
86	  <entry>Returns true if specified year is a leap year.</entry>
87	</row>
88        <row>
89          <entry><screen>gregorian_calendar::is_leap_year(2000)
90//--> true</screen></entry>
91	</row>
92      </tbody>
93    </tgroup>
94  </informaltable>
95
96</section>
97