summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/date_time/xmldoc/gregorian_calendar.xml
blob: 293e442b3731585ec93dd915b1c6002659c65320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" 
"../../../tools/boostbook/dtd/boostbook.dtd">

<!-- Copyright (c) 2001-2005 CrystalClear Software, Inc.
     Subject to the Boost Software License, Version 1.0. 
     (See accompanying file LICENSE_1_0.txt or  http://www.boost.org/LICENSE_1_0.txt)
-->

<section id="date_time.gregorian.gregorian_calendar">
  <title>Gregorian Calendar</title>

  <link linkend="gregcal_intro">Introduction</link> --
  <link linkend="gregcal_header">Header</link> --
  <link linkend="gregcal_functions">Functions</link>

  <anchor id="gregcal_intro" />
  <bridgehead renderas="sect3">Introduction</bridgehead>
  <para>
    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. 
  </para>
  <para>
    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. 
  </para>
  <para>
    The <link linkend="date_time.examples.print_month">print month</link> example demonstrates this. 
  </para>

  <anchor id="gregcal_header" />
  <bridgehead renderas="sect3">Header</bridgehead>
  <para>
    <programlisting>#include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o
or
#include "boost/date_time/gregorian/gregorian_types.hpp" //no i/o just types</programlisting>
  </para>

  <anchor id="gregcal_functions" />
  <bridgehead renderas="sect3">Functions</bridgehead>
  <informaltable frame="all">
    <tgroup cols="2">
      <thead>
	<row>
	  <entry valign="top" morerows="1">Syntax</entry>
	  <entry>Description</entry>
	</row>
	<row>
	  <entry>Example</entry>
	</row>
      </thead>
      <tbody>
        <row>
	  <entry valign="top" morerows="1"><screen>static short day_of_week(ymd_type)</screen></entry>
	  <entry>Return the day of the week (0==Sunday, 1==Monday, etc)</entry>
	</row>
	<row>
	  <entry>See also <link linkend="date_time.gregorian.date_class">gregorian::date</link> day_of_week</entry>
        </row>

	<row>
	  <entry valign="top" morerows="1"><screen>static date_int_type day_number(ymd_type)</screen></entry>
	  <entry> Convert a ymd_type into a day number. The day number mapping is implementation defined, however the library implements the 1400-01-01 epoch as follows <screen> date(gregorian_calendar::epoch()).day_number() == 2232400</screen></entry>
	</row>
	<row>
	  <entry></entry>
        </row>
        
	<row>
          <entry valign="top" morerows="1"><screen>static short end_of_month_day(year_type,
                              month_type)</screen></entry>
	  <entry>Given a year and month determine the last day of the month.</entry>
	</row>
	<row>
	  <entry></entry>
        </row>
        
	<row>
	  <entry valign="top" morerows="1"><screen>static ymd_type from_day_number(date_int_type)</screen></entry>
	  <entry> Convert a day number to a ymd struct.</entry>
	</row>
	<row>
	  <entry></entry>
        </row>
        
	<row>
	  <entry valign="top" morerows="1"><screen>static bool is_leap_year(year_type)</screen></entry>
	  <entry>Returns true if specified year is a leap year.</entry>
	</row>
        <row>
          <entry><screen>gregorian_calendar::is_leap_year(2000)
//--> true</screen></entry>
	</row>
      </tbody>
    </tgroup>
  </informaltable>

</section>