本文整理汇总了VB.NET中Microsoft.VisualBasic.DateAndTime.DateDiff方法的典型用法代码示例。如果您正苦于以下问题:VB.NET DateAndTime.DateDiff方法的具体用法?VB.NET DateAndTime.DateDiff怎么用?VB.NET DateAndTime.DateDiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了DateAndTime.DateDiff方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: InputBox
Dim date2Entered As String = InputBox("Enter a date")
Try
Dim date2 As Date = Date.Parse(date2Entered)
Dim date1 As Date = Now
' Determine the number of days between the two dates.
Dim days As Long = DateDiff(DateInterval.Day, date1, date2)
' This statement has a string interval argument, and
' is equivalent to the above statement.
'Dim days As Long = DateDiff("d", date1, date2)
MessageBox.Show("Days from today: " & days.ToString)
Catch ex As Exception
MessageBox.Show("Invalid Date: " & ex.Message)
End Try
开发者ID:VB.NET开发者,项目名称:Microsoft.VisualBasic,代码行数:17,代码来源:DateAndTime.DateDiff
示例2: DateDiff
' The following statements set datTim1 to a Thursday
' and datTim2 to the following Tuesday.
Dim datTim1 As Date = #1/4/2001#
Dim datTim2 As Date = #1/9/2001#
' Assume Sunday is specified as first day of the week.
Dim wD As Long = DateDiff(DateInterval.Weekday, datTim1, datTim2)
Dim wY As Long = DateDiff(DateInterval.WeekOfYear, datTim1, datTim2)
开发者ID:VB.NET开发者,项目名称:Microsoft.VisualBasic,代码行数:7,代码来源:DateAndTime.DateDiff
示例3:
Dim startTime As Date = Now
' Run the process that is to be timed.
Dim runLength As Global.System.TimeSpan = Now.Subtract(startTime)
Dim millisecs As Double = runLength.TotalMilliseconds
开发者ID:VB.NET开发者,项目名称:Microsoft.VisualBasic,代码行数:4,代码来源:DateAndTime.DateDiff
注:本文中的Microsoft.VisualBasic.DateAndTime.DateDiff方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论