有谁知道如何将这些字符串十六进制值转换回 DateTime 值?
属性 my_DateProperty (System.String) = 0x01c9874e|0x98f28800
//l_item is SPListItem
Hashtable l_properties = l_item.Properties;
if (l_properties != null)
{
object l_value = null;
foreach (string l_key in l_properties.Keys)
{
l_value = l_properties[l_key];
Splogger.log("Property " + l_key + " (" + l_value.GetType().ToString() + ") = " + l_value.ToString());
}
}
最佳答案
我最近发现这似乎只发生在 Office 2007 文档上(对于其他文件类型,该值是日期的标准字符串格式)。答案是十六进制值表示自 1/1/1600 以来的刻度数。这是对我有用的转换:
Dim dateVal as DateTime = New DateTime(Long.Parse(dateText.Replace("0x", "").Replace("|", ""), System.Globalization.NumberStyles.HexNumber)).AddYears(1600) )
关于sharepoint - SPListItem.Properties DateTime 字段采用奇怪的十六进制格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/521078/