本文整理汇总了VB.NET中System.TimeSpan.FromMilliseconds方法的典型用法代码示例。如果您正苦于以下问题:VB.NET TimeSpan.FromMilliseconds方法的具体用法?VB.NET TimeSpan.FromMilliseconds怎么用?VB.NET TimeSpan.FromMilliseconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.TimeSpan 的用法示例。
在下文中一共展示了TimeSpan.FromMilliseconds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: FromMillisecDemo
' Example of the TimeSpan.FromMilliseconds( Double ) method.
Module FromMillisecDemo
Sub GenTimeSpanFromMillisec( millisec As Double )
' Create a TimeSpan object and TimeSpan string from
' a number of milliseconds.
Dim interval As TimeSpan = _
TimeSpan.FromMilliseconds( millisec )
Dim timeInterval As String = interval.ToString( )
' Pad the end of the TimeSpan string with spaces if it
' does not contain milliseconds.
Dim pIndex As Integer = timeInterval.IndexOf( ":"c )
pIndex = timeInterval.IndexOf( "."c, pIndex )
If pIndex < 0 Then timeInterval &= " "
Console.WriteLine( "{0,21}{1,26}", millisec, timeInterval )
End Sub
Sub Main( )
Console.WriteLine( "This example of " & _
"TimeSpan.FromMilliseconds( Double )" & _
vbCrLf & "generates the following output." & vbCrLf )
Console.WriteLine( "{0,21}{1,18}", _
"FromMilliseconds", "TimeSpan" )
Console.WriteLine( "{0,21}{1,18}", _
"----------------", "--------" )
GenTimeSpanFromMillisec( 1 )
GenTimeSpanFromMillisec( 1.5 )
GenTimeSpanFromMillisec( 12345.6 )
GenTimeSpanFromMillisec( 123456789.8 )
GenTimeSpanFromMillisec( 1234567898765.4 )
GenTimeSpanFromMillisec( 1000 )
GenTimeSpanFromMillisec( 60000 )
GenTimeSpanFromMillisec( 3600000 )
GenTimeSpanFromMillisec( 86400000 )
GenTimeSpanFromMillisec( 1801220200 )
End Sub
End Module
' This example of TimeSpan.FromMilliseconds( Double )
开发者ID:VB.NET开发者,项目名称:System,代码行数:44,代码来源:TimeSpan.FromMilliseconds 输出:
FromMilliseconds TimeSpan
---------------- --------
1 00:00:00.0010000
1.5 00:00:00.0020000
12345.6 00:00:12.3460000
123456789.8 1.10:17:36.7900000
1234567898765.4 14288.23:31:38.7650000
1000 00:00:01
60000 00:01:00
3600000 01:00:00
86400000 1.00:00:00
1801220200 20.20:20:20.2000000
注:本文中的System.TimeSpan.FromMilliseconds方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论