分析C++/CX中的JSON ISO8601日期
Parse JSON ISO8601 date in C++/CX
我有一个来自JSON"2012-08-01T15:42:06Z"的日期字符串,希望在Windows Runtime中解析它。据我所知,只有COleDateTime可用于处理此问题。
只有当我去掉"T"&Z'字符,但这为我的端添加了额外的解析步骤。
作品:
COleDateTime dateTime;
dateTime.ParseDateTime(L"2012-08-01 15:42:06", 0UL, 1033UL);
失败:
COleDateTime dateTime;
dateTime.ParseDateTime(L"2012-08-01T15:42:06Z", 0UL, 1033UL);
有人知道吗?
如果您的日期字符串格式一致,您可以使用std::get_time
将时间解析到tm
结构中,将相关位复制到SYSTEMTIME
中,然后从那里转换为FILETIME
,然后转换为Windows::Foundation::DateTime
。
std::get_time
信息:http://en.cppreference.com/w/cpp/io/manip/get_time
从SYSTEMTIME
转换为DateTime
的代码:如何在Metro(C++/CX)应用程序中解析日期?
相关文章:
- 在c++中使用nlohmann从类到json的转换
- C++json插入数组
- nlohmann-json将一个数组插入到另一个数组中
- 如何使用curlpp通过POST方法上传文件和json数据
- JSON转换为nlohmann JSON-lib中的结构数组
- NLOHMANN 的 JSON 库将数组转换为结构向量
- 在nlohmann json中,如何将嵌套对象的数组转换为嵌套结构的向量
- 如何在 nlohmann 的 json 库中获取数组长度?
- UE4 C++ 我无法将 JSON 嵌套值获取到 TArray
- 如何在特定位置追加 json 文件
- 有没有办法让编译器在我放置字符串而不是 nlohmann::json 对象时抛出错误?
- 使用 jsoncpp 解析 json 数组字符串
- 将 FlatBuffer 对象序列化为 JSON,而不使用其架构文件
- 如何在 c++ 非托管代码中反序列化 byte[] 的 json 字符串?
- 使用 cmake 生成 compile_commands.json
- 如何使用 c++ 和提升库生成 json
- 使用 minijson-reader 库读取 JSON 字符串时出现问题
- 使用 Qt 解析 JSON 数组
- 如何使用 picojson.h 在 c++ 中从头开始创建 json 对象
- 分析C++/CX中的JSON ISO8601日期