0

我有一个像这样的时间跨度变量:

dim startime as timespan 

我的开始时间值为:11:30:15(我的意思是 11Hr.30mnt,15 秒)。
我如何将每个值获取到不同的变量..我的意思是

dim hr as integer  
dim mnt as integer 
dim sec as integer 

我想得到 hr=11 ,mnt=30,sec=15
我尝试过这样的事情:

Dim hour As integer = TimeSpan.FromHours(starttime) 

但这次显示错误:

值类型“System.timespan”无法转换为“Double”

4

1 回答 1

2
Dim startTime As New TimeSpan(11, 30, 15)
Dim hours As Integer = startTime.Hours
Dim mnt as Integer = startTime.Minutes
Dim sec as Integer = startTime.Seconds
Dim allMinutes as Double = startTime.TotalMinutes
于 2013-09-19T14:19:23.580 回答