Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7568521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:56:50+00:00 2026-05-30T14:56:50+00:00

In the Boost date time library, is there a utility function for converting month

  • 0

In the Boost date time library, is there a utility function for converting month short strings (e.g. Jan, Feb, Mar, Apr) to boost::gregorian::greg_month type? The documentation for the library isn’t great and I can’t see anything in the headers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:56:51+00:00Added an answer on May 30, 2026 at 2:56 pm

    A hacky work around could be:

    #include <iostream>
    #include <boost/date_time/gregorian/gregorian.hpp>
    
    int main(void)
    {
      auto ptr = boost::gregorian::greg_month::get_month_map_ptr();
    
      if (ptr)
      {
        auto it = ptr->begin();
        for(; it != ptr->end(); ++it)
        {
          std::cout << it->first << " " << it->second << '\n';
        }
      }
    }
    

    This map contains mapping between all the short/long names and the short necessary to create a greg_month instance. Just need to create a little wrapper around it…

    per Graeme’s discovery, there is a convenience function which wraps this already boost::date_time::month_str_to_ushort<>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I discovered a strange result in Boost C++ date time library. There is inconsistency
Is there a C/C++/STL/Boost clean method to convert a date time string to epoch
Input : strings with date and optional time. Different representations would be nice but
How can I subtract a length-of-time from a boost gregorian date? Let's say I
I have a boost::posix_time::ptime that points to March 31st 2010 like this: ptime p(date(2010,
Boost is meant to be the standard non-standard C++ library that every C++ user
Boost is a very large library with many inter-dependencies -- which also takes a
I am using the timed_wait from boost C++ library and I am getting a
I am writing a C++ app that has to parse a date/time string and
I'm just getting started with Boost for the first time, details: I'm using Visual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.