gregorian_calendar.xml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. <!-- Copyright (c) 2001-2005 CrystalClear Software, Inc.
  5. Subject to the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  7. -->
  8. <section id="date_time.gregorian.gregorian_calendar">
  9. <title>Gregorian Calendar</title>
  10. <link linkend="gregcal_intro">Introduction</link> --
  11. <link linkend="gregcal_header">Header</link> --
  12. <link linkend="gregcal_functions">Functions</link>
  13. <anchor id="gregcal_intro" />
  14. <bridgehead renderas="sect3">Introduction</bridgehead>
  15. <para>
  16. 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.
  17. </para>
  18. <para>
  19. 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.
  20. </para>
  21. <para>
  22. The <link linkend="date_time.examples.print_month">print month</link> example demonstrates this.
  23. </para>
  24. <anchor id="gregcal_header" />
  25. <bridgehead renderas="sect3">Header</bridgehead>
  26. <para>
  27. <programlisting>#include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o
  28. or
  29. #include "boost/date_time/gregorian/gregorian_types.hpp" //no i/o just types</programlisting>
  30. </para>
  31. <anchor id="gregcal_functions" />
  32. <bridgehead renderas="sect3">Functions</bridgehead>
  33. <informaltable frame="all">
  34. <tgroup cols="2">
  35. <thead>
  36. <row>
  37. <entry valign="top" morerows="1">Syntax</entry>
  38. <entry>Description</entry>
  39. </row>
  40. <row>
  41. <entry>Example</entry>
  42. </row>
  43. </thead>
  44. <tbody>
  45. <row>
  46. <entry valign="top" morerows="1"><screen>static short day_of_week(ymd_type)</screen></entry>
  47. <entry>Return the day of the week (0==Sunday, 1==Monday, etc)</entry>
  48. </row>
  49. <row>
  50. <entry>See also <link linkend="date_time.gregorian.date_class">gregorian::date</link> day_of_week</entry>
  51. </row>
  52. <row>
  53. <entry valign="top" morerows="1"><screen>static date_int_type day_number(ymd_type)</screen></entry>
  54. <entry> Convert a ymd_type into a day number. The day number is an absolute number of days since the epoch start.</entry>
  55. </row>
  56. <row>
  57. <entry></entry>
  58. </row>
  59. <row>
  60. <entry valign="top" morerows="1"><screen>static short end_of_month_day(year_type,
  61. month_type)</screen></entry>
  62. <entry>Given a year and month determine the last day of the month.</entry>
  63. </row>
  64. <row>
  65. <entry></entry>
  66. </row>
  67. <row>
  68. <entry valign="top" morerows="1"><screen>static ymd_type from_day_number(date_int_type)</screen></entry>
  69. <entry> Convert a day number to a ymd struct.</entry>
  70. </row>
  71. <row>
  72. <entry></entry>
  73. </row>
  74. <row>
  75. <entry valign="top" morerows="1"><screen>static bool is_leap_year(year_type)</screen></entry>
  76. <entry>Returns true if specified year is a leap year.</entry>
  77. </row>
  78. <row>
  79. <entry><screen>gregorian_calendar::is_leap_year(2000)
  80. //--> true</screen></entry>
  81. </row>
  82. </tbody>
  83. </tgroup>
  84. </informaltable>
  85. </section>