Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is an old version of boost. Click here for the latest version's documentation home page.
C++ Boost



Overall Index -- Gregorian Index -- Posix Time Index

Date Documentation

Header -- Functions


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.

For most purposes this class is simply accessed by gregorian::date 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.

The print month example demonstrates this.


#include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o
#include "boost/date_time/gregorian/gregorian_types.hpp" //no i/o just types


static short day_of_week(ymd_type) Return the day of the week (0==Sunday, 1==Monday, etc) See also gregorian::date day_of_week
static date_int_type day_number(ymd_type) Convert a ymd_type into a day number. The day number is an absolute number of days since the epoch start.
static short end_of_month_day(year_type, month_type) Given a year and month determine the last day of the month.
static ymd_type from_day_number(date_int_type) Convert a day number to a ymd struct.
static bool is_leap_year(year_type) Returns true if specified year is a leap year. gregorian_calendar::is_leap_year(2000) --> true

Last modified: Thu Sep 5 06:05:54 MST 2002 by Jeff Garland © 2000-2002