Windows::Foundation::DateTime
Windows::Foundation::DateTime
我目前正在使用Windows::Foundation::D ateTime结构,它为UTC时间(其UniversalTime成员)给我的值不是UNIX时间戳,我找不到任何关于如何读取它的文档。 所以我做了一些测试:
Let
A equal 129862800600000000 where A is UniversalTime's value at 23:00 on 11/7/2012
and let
B equal 129862476000000000 where B is UniversalTime's value at 15:00 on 11/7/2012
We can there for assume that 8 hours of time in whatever format UniversalTime takes can be interpreted as A-B. We therefore have
A-B = 3246000000 = 8 hours
(A-B)/8 = 405750000 = 1 hour
((A-B)/8)/60 = 6762500 = 1 minute
(((A-B)/8)/60)/60 = 112708.(3...) = 1 second
事实证明这是完全不正确的。 例如,如果将 405750000 添加到 DateTime 对象的 UniversalTime 成员,则它肯定不会为其增加一小时。 相反,它似乎只增加了 40 秒。
基本上,我只需要能够确定自 unix 时代以来经过的天数。
无论如何,如果有人有任何建议或帮助,那就太好了。
编辑:我还考虑过他们使用位掩码来获取/设置所有内容的可能性。 但目前我不确定如何去检查它。 (现在是凌晨4点,我需要睡觉。 罗福尔)
编辑 2:我目前正在尝试做的事情的示例:
if((post_date.UniversalTime/(60*60*24))>num_seconds_since_unix_epoch_for_current_day){
date_formatter=ref new DateTimeFormatter("{month.abbreviated} {day.integer(1)}, {year.full} at {hour.integer(1)}:{minute.integer(2)}:{second.integer(2)}");
}else{
date_formatter=ref new DateTimeFormatter("Today at {hour.integer(1)}:{minute.integer(2)}");
}
date_string = date_formatter->format(post_date);
Windows::Foundation::D ateTime 的 UniversalTime 字段是自 1/1/1601 以来的 100ns 单位数。 它与Windows FILETIME结构完全相同。 请注意,世界时是 UTC,通常与当地时间不同。
根据此 MS 教程,您可以使用 日期时间格式化格式化 日期时间格式化时间格式化格式化时间格式化时间格式化日期时间格式化时间时间格式化日期时间格式化日期时间格式化时间格式化日期时间格式化时间时间
Windows::Foundation::DateTime dt = (Windows::Foundation::DateTime) value;
Windows::Globalization::DateTimeFormatting::DateTimeFormatter^ dtf =
Windows::Globalization::DateTimeFormatting::DateTimeFormatter::LongDate::get();
dtf->Format(dt);
相关文章:
- 如何在MySQL Connector/C++ 8.0中使用DATETIME?
- 如何使用xdevapi从mysql获取DateTime
- 如何在Windows Media Foundation中获取相机外部函数?
- 使用Strftime格式化DateTime
- 从c++11 time_t创建一个可转换为.net DateTime的字符串
- 如何在Windows Media Foundation SDK中指定语言列表对象
- Windows Media Foundation MFCreateSourceReaderFromURL 函数中的内存泄
- 无法在 WinRT 中获取异步操作结果 (Windows::Foundation::IAsyncOperating 接口
- 将DateTime字符串分为C 的日期时间
- Bjarne Stroustrup在他的FAQ中"foundation libraries"是什么意思?
- 仅使用boost.datetime在Windows上有错误
- Windows Media Foundation:IMFSourcereader :: SetCurrentMediat
- 如何使用Media Foundation同时播放两个声音
- 在导入 Foundation 的 objective-c 文件上运行 Clang-query
- 获取错误mf_e_streamsinks_fixed用于EVR -Windows Media Foundation
- 如何使用mySQL连接器/C 获取DateTime并将其存储到TIME_T
- 我该如何告诉CMAKE找到Windows Media Foundation
- 如何使用Microsoft Media Foundation的水槽作家播放音频
- Windows::Foundation::DateTime
- 如何从std::tm转换为Windows::Foundation::DateTime