在Boost日期时间库中,是否存在将月份短字符串(例如Jan,Feb,Mar,Apr)转换为boost :: gregorian :: greg_month类型的实用函数?该库的文档不是很好,我看不到标题中的任何内容。将字符串转换为boost :: gregorian :: greg_month
0
A
回答
1
哈克变通可能是:
#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';
}
}
}
该地图包含了所有的短/长名和短必要之间的映射创建一个greg_month
实例。只需要创建一个围绕它一点包装...
每格雷姆的发现,有它封装本已boost::date_time::month_str_to_ushort<>
0
是的,有提升日期时间构面可用于创建语言环境并将其放入流中。
请注意,如果您打算打印或解析大量日期和时间,则不会为您解析的每个日期和区域创建方面和区域设置。
查看here了解有关输入日期的文档。他们的一些示例使用了短短的一个月的名称,这似乎有%b
其format specifier
相关问题
- 1. 将boost :: gregorian :: date_duration转换为double
- 2. Qt创建者:对`boost :: gregorian :: greg_month :: as_short_string()const'的未定义引用
- 3. C++:将Julian日期转换为Gregorian
- 4. 如何将std :: string转换为boost :: gregorian :: date?
- 5. boost :: interprocess ::字符串转换为char *
- 6. boost :: serialization - 转换为字符串
- 7. 将字符串转换为字符串
- 8. 将字符串转换为字符串
- 9. 将字符串转换为字符串
- 10. 将字符串转换为int,int转换为字符串
- 11. 将字符串转换为“_”
- 12. 将字符串转换为
- 13. 将字符串转换为?
- 14. 将JDE Julian日期转换为Gregorian
- 15. 将转换器映射字符串转换为字符串
- 16. 如何将boost beast multi_buffer转换为字符串?
- 17. 将boost std :: string :: const_iterator转换为字符串和int C++
- 18. 如何将boost :: date_time :: date :: day_of_week()转换为字符串类型?
- 19. 使用std :: stringstream将boost :: int64_t大数转换为字符串。
- 20. 将const const wchar_t *转换为python字符串在boost python
- 21. 在C++中使用boost :: lexical_cast将double转换为字符串?
- 22. 将字符串转换为字符ascii
- 23. Java - 将字符串转换为字符[]
- 24. C++ - 将字符串转换为字符
- 25. 将字符*转换为字符串
- 26. 将字符串转换为字符
- 27. 将字符串转换为const *字符
- 28. 将字符[]转换为字符串
- 29. InfixToPostfix将字符转换为字符串
- 30. 将字符串转换为字符
刚刚发现的功能已经wrappin这一个方便的功能:刺激:: date_time的:: month_str_to_ushort 。谢谢您的帮助! –
Graeme
2012-02-24 14:31:18
@Graeme,啊哈 - 它必须在那里 - 这是一个很平凡的功能...... :) – Nim 2012-02-24 14:32:09