Boost logo

Boost Users :

Subject: [Boost-users] [date time] How to get "10" and not "Oct"
From: Ken Murphy (murf_at_[hidden])
Date: 2011-10-24 13:03:16

I have the following code:

std::string db_time()
        typedef boost::posix_time::ptime TimeT;
        TimeT ct = boost::posix_time::microsec_clock::local_time();
        std::stringstream ss;

        boost::local_time::local_time_facet* output_facet = new
boost::local_time::local_time_facet("%Y-%m-%d %h:%m:%s");
        ss.imbue(std::locale(std::locale::classic(), output_facet));
        ss << ct;

        return ss.str();

Currently, the following string is returned:

2011-Oct-24 12:43:05.476990

How do I get the month as "10" and not as "Oct"?


Ken Murphy

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at