本文整理匯總了VB.NET中System.DateTime.ToFileTime方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET DateTime.ToFileTime方法的具體用法?VB.NET DateTime.ToFileTime怎麽用?VB.NET DateTime.ToFileTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.DateTime
的用法示例。
在下文中一共展示了DateTime.ToFileTime方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Main
Public Shared Sub Main()
System.Console.WriteLine("Enter the file path:")
Dim filePath As String
filePath = System.Console.ReadLine()
If System.IO.File.Exists(filePath) Then
Dim fileCreationDateTime As System.DateTime
fileCreationDateTime = System.IO.File.GetCreationTime(filePath)
Dim fileCreationFileTime As Long
fileCreationFileTime = fileCreationDateTime.ToFileTime()
System.Console.WriteLine("{0} in file time is {1}.", _
fileCreationDateTime, _
fileCreationFileTime)
Else
System.Console.WriteLine("{0} is an invalid file", filePath)
End If
End Sub
示例2: Example
Module Example
Public Sub Main()
Dim date1 As New DateTime(2010, 3, 14, 2, 30, 00)
Console.WriteLine("Invalid Time: {0}", TimeZoneInfo.Local.IsInvalidTime(date1))
Dim ft As Long = date1.ToFileTime()
Dim date2 As DateTime = DateTime.FromFileTime(ft)
Console.WriteLine("{0} -> {1}", date1, date2)
End Sub
End Module
輸出:
Invalid Time: True 3/14/2010 2:30:00 AM -> 3/14/2010 3:30:00 AM