本文介绍了将FILETIME转换为DateTime时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 它应该很简单, 将FILETIME放入长期 使用DateTime.FromFileTimeUtc 帮助甚至说:将指定的Windows文件时间转换为 等效的UTC时间。 现在为什么会这样: 原始文件时间21/02/2006 00:33:29 字节: 80 C2 E6 AB 6D 36 C6 01 当我兑换它时我有: 1)20/02/2006 22:26:19 2)20/02/2006 22:26:19 代码: Dim ad3 As System.DateTime Dim aLn1 As Long Dim ad1 As System.Runtime.InteropServices.ComTypes.FILETIME ad1.dwHighDateTime =& H1C6366D ad1.dwLowDateTime =& HABE6C280 aLn1 =(CLng(ad1.dwHighDateTime)<< 32)+ CLng(ad1.dwLowDateTime) > ad3 = DateTime.FromFileTimeUtc(aLn1) Debug.Print(" 1)" &安培; ad3) ad3.ToLocalTime() Debug.Print(" 2)" &安培; ad3) ,如果我这样做甚至更糟: ad3 = CDate(21/02/2006 00:33:29) Thicks财产等于: ad3.Ticks& H8C8049591E69280 Long 请有人可以帮助我吗? 谢谢, M. 解决方案 /msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDateTimeClassFromFileTimeUtcTopic.asp\"target =_ blank> http://msdn.microsoft.com/library/de。 ..meUtcTopic.asp Cor " msavazzi" <米******* @ discussion.microsoft.com> schreef in bericht 新闻:BA ********************************** @ microsof t.com ... Hi,it should be simple,put FILETIME in a Longconver it in date using the DateTime.FromFileTimeUtcThe help even says: Converts the specified Windows file time to anequivalent UTC time.Now why happens this:original filetime 21/02/2006 00:33:29bytes:80C2E6AB6D36C601when I convert it I have:1) 20/02/2006 22:26:192) 20/02/2006 22:26:19Code:Dim ad3 As System.DateTimeDim aLn1 As LongDim ad1 As System.Runtime.InteropServices.ComTypes.FILETIMEad1.dwHighDateTime = &H1C6366Dad1.dwLowDateTime = &HABE6C280aLn1 = (CLng(ad1.dwHighDateTime) << 32) + CLng(ad1.dwLowDateTime)ad3 = DateTime.FromFileTimeUtc(aLn1)Debug.Print("1) " & ad3)ad3.ToLocalTime()Debug.Print("2) " & ad3)and even worst if I do:ad3 = CDate("21/02/2006 00:33:29")the Thicks property is equal to:ad3.Ticks&H8C8049591E69280Longplease can anyone help me?Thanks,M. 解决方案 这篇关于将FILETIME转换为DateTime时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-07 23:45