本文整理匯總了VB.NET中System.DateTimeOffset.Ticks屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET DateTimeOffset.Ticks屬性的具體用法?VB.NET DateTimeOffset.Ticks怎麽用?VB.NET DateTimeOffset.Ticks使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.DateTimeOffset
的用法示例。
在下文中一共展示了DateTimeOffset.Ticks屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: DateTimeOffset
' Attempt to initialize date to number of ticks
' in July 1, 2008 1:23:07.
'
' There are 10,000,000 100-nanosecond intervals in a second
Const NSPerSecond As Long = 10000000
Dim ticks As Long
ticks = 7 * NSPerSecond ' Ticks in a 7 seconds
ticks += 23 * 60 * NSPerSecond ' Ticks in 23 minutes
ticks += 1 * 60 * 60 * NSPerSecond ' Ticks in 1 hour
ticks += 60 * 60 * 24 * NSPerSecond ' Ticks in 1 day
ticks += 181 * 60 * 60 * 24 * NSPerSecond ' Ticks in 6 months
ticks += 2007 * 60 * 60 * 24 * 365l * NSPerSecond ' Ticks in 2007 years
ticks += 486 * 60 * 60 * 24 * NSPerSecond ' Adjustment for leap years
Dim dto As DateTimeOffset = New DateTimeOffset( _
ticks, _
DateTimeOffset.Now.Offset)
Console.WriteLine("There are {0:n0} ticks in {1}.", _
dto.Ticks, _
dto.ToString())
輸出:
There are 633,504,721,870,000,000 ticks in 7/1/2008 1:23:07 AM -08:00.