本文整理匯總了VB.NET中System.TimeSpan.TicksPerSecond字段的典型用法代碼示例。如果您正苦於以下問題:VB.NET TimeSpan.TicksPerSecond字段的具體用法?VB.NET TimeSpan.TicksPerSecond怎麽用?VB.NET TimeSpan.TicksPerSecond使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。您也可以進一步了解該字段所在類System.TimeSpan
的用法示例。
在下文中一共展示了TimeSpan.TicksPerSecond字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: TimeSpanFieldsDemo
' Example of the TimeSpan fields.
Module TimeSpanFieldsDemo
' Pad the end of a TimeSpan string with spaces if it does not
' contain milliseconds.
Function Align( interval As TimeSpan ) As String
Dim intervalStr As String = interval.ToString( )
Dim pointIndex As Integer = intervalStr.IndexOf( ":"c )
pointIndex = intervalStr.IndexOf( "."c, pointIndex )
If pointIndex < 0 Then intervalStr &= " "
Align = intervalStr
End Function
Sub Main( )
Const numberFmt As String = "{0,-22}{1,18:N0}"
Const timeFmt As String = "{0,-22}{1,26}"
Console.WriteLine( _
"This example of the fields of the TimeSpan class" & _
vbCrLf & "generates the following output." & vbCrLf )
Console.WriteLine( numberFmt, "Field", "Value" )
Console.WriteLine( numberFmt, "-----", "-----" )
' Display the maximum, minimum, and zero TimeSpan values.
Console.WriteLine( timeFmt, "Maximum TimeSpan", _
Align( TimeSpan.MaxValue ) )
Console.WriteLine( timeFmt, "Minimum TimeSpan", _
Align( TimeSpan.MinValue ) )
Console.WriteLine( timeFmt, "Zero TimeSpan", _
Align( TimeSpan.Zero ) )
Console.WriteLine( )
' Display the ticks-per-time-unit fields.
Console.WriteLine( numberFmt, "Ticks per day", _
TimeSpan.TicksPerDay )
Console.WriteLine( numberFmt, "Ticks per hour", _
TimeSpan.TicksPerHour )
Console.WriteLine( numberFmt, "Ticks per minute", _
TimeSpan.TicksPerMinute )
Console.WriteLine( numberFmt, "Ticks per second", _
TimeSpan.TicksPerSecond )
Console.WriteLine( numberFmt, "Ticks per millisecond", _
TimeSpan.TicksPerMillisecond )
End Sub
End Module
' This example of the fields of the TimeSpan class
輸出:
Field Value ----- ----- Maximum TimeSpan 10675199.02:48:05.4775807 Minimum TimeSpan -10675199.02:48:05.4775808 Zero TimeSpan 00:00:00 Ticks per day 864,000,000,000 Ticks per hour 36,000,000,000 Ticks per minute 600,000,000 Ticks per second 10,000,000 Ticks per millisecond 10,000