C++ Boost ptime:如何以浏览器在http请求头内部发送数据的方式格式化数据?

C++ Boost ptime:如何以浏览器在http请求头内部发送数据的方式格式化数据?,c++,boost,boost-date-time,C++,Boost,Boost Date Time,我需要以这样的方式格式化我的ptimeWed,2004年1月21日19:51:30 GMT如何使用boost做这样的事情?(因此它看起来像HTTP服务器的数据格式Expires和Last Modified和Date响应头)包括 #包括 #包括 #包括 #包括 std::字符串当前\u时间\u格式() { 名称空间bpt=boost::posix_time; 静态字符常量*常量fmt=“%a,%d%b%Y%H:%M:%S GMT”; std::ostringstream ss; //假设std::

我需要以这样的方式格式化我的ptime
Wed,2004年1月21日19:51:30 GMT
如何使用boost做这样的事情?(因此它看起来像HTTP服务器的数据格式
Expires
Last Modified
Date
响应头)

包括
#包括
#包括
#包括
#包括
std::字符串当前\u时间\u格式()
{
名称空间bpt=boost::posix_time;
静态字符常量*常量fmt=“%a,%d%b%Y%H:%M:%S GMT”;
std::ostringstream ss;
//假设std::cout的区域设置已为整个应用程序正确设置
imbue(std::locale(std::cout.getloc(),新的bpt::time_facet(fmt));
ss>
#include <locale>
#include <string>
#include <iostream>
#include <sstream>
#include <boost/date_time/posix_time/posix_time.hpp>

std::string current_time_formatted()
{
    namespace bpt = boost::posix_time;

    static char const* const fmt = "%a, %d %b %Y %H:%M:%S GMT";
    std::ostringstream ss;
    // assumes std::cout's locale has been set appropriately for the entire app
    ss.imbue(std::locale(std::cout.getloc(), new bpt::time_facet(fmt)));
    ss << bpt::second_clock::universal_time();
    return ss.str();
}