本文整理匯總了VB.NET中System.DateTime.Subtraction操作符的典型用法代碼示例。如果您正苦於以下問題:VB.NET DateTime.Subtraction操作符的具體用法?VB.NET DateTime.Subtraction怎麽用?VB.NET DateTime.Subtraction使用的例子?那麽, 這裏精選的操作符代碼示例或許可以為您提供幫助。您也可以進一步了解該操作符所在類System.DateTime
的用法示例。
在下文中一共展示了DateTime.Subtraction操作符的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1:
Dim date1 As New System.DateTime(1996, 6, 3, 22, 15, 0)
Dim date2 As New System.DateTime(1996, 12, 6, 13, 2, 0)
Dim date3 As New System.DateTime(1996, 10, 12, 8, 42, 0)
Dim diff1 As System.TimeSpan
' diff1 gets 185 days, 14 hours, and 47 minutes.
diff1 = date2.Subtract(date1)
Dim date4 As System.DateTime
' date4 gets 4/9/1996 5:55:00 PM.
date4 = date3.Subtract(diff1)
Dim diff2 As System.TimeSpan
' diff2 gets 55 days 4 hours and 20 minutes.
diff2 = System.DateTime.op_Subtraction(date2, date3)
Dim date5 As System.DateTime
' date5 gets 4/9/1996 5:55:00 PM.
date5 = System.DateTime.op_Subtraction(date1, diff2)