| Home | Libraries | People | FAQ | More

## Class greg_month

boost::gregorian::greg_month — Wrapper class to represent months in gregorian based calendar.

## Synopsis

    // In header: <boost/date_time/gregorian/greg_month.hpp>

    class greg_month {
    public:
      // types
      typedef date_time::months_of_year               month_enum;
      typedef std::map< std::string, unsigned short > month_map_type;
      typedef boost::shared_ptr< month_map_type >     month_map_ptr_type;

      // construct/copy/destruct
      greg_month(month_enum);
      greg_month(unsigned short);

      // public member functions
      operator unsigned short() const;
      unsigned short as_number() const;
      month_enum as_enum() const;
      const char * as_short_string() const;
      const char * as_long_string() const;
      const wchar_t * as_short_wstring() const;
      const wchar_t * as_long_wstring() const;
      const char * as_short_string(char) const;
      const char * as_long_string(char) const;
      const wchar_t * as_short_string(wchar_t) const;
      const wchar_t * as_long_string(wchar_t) const;

      // public static functions
      static month_map_ptr_type get_month_map_ptr();
    };

## Description

### `greg_month` public construct/copy/destruct

1.     greg_month(month_enum theMonth);

   Construct a month from the months_of_year enumeration.

2.     greg_month(unsigned short theMonth);

   Construct from a short value.

### `greg_month` public member functions

1.     operator unsigned short() const;

   Convert the value back to a short.

2.     unsigned short as_number() const;

   Returns month as number from 1 to 12.

3.     month_enum as_enum() const;

4.     const char * as_short_string() const;

5.     const char * as_long_string() const;

6.     const wchar_t * as_short_wstring() const;

7.     const wchar_t * as_long_wstring() const;

8.     const char * as_short_string(char) const;

9.     const char * as_long_string(char) const;

10.     const wchar_t * as_short_string(wchar_t) const;

11.     const wchar_t * as_long_string(wchar_t) const;

### `greg_month` public static functions

1.     static month_map_ptr_type get_month_map_ptr();

   Shared pointer to a map of Month strings (Names & Abbrev) & numbers.