我可以使用给定的代码vb.Net时间跨度计算
Dim dtStartDate As Date = "17/12/2032"
Dim iNumberOfDays As Integer
Dim tsTimeSpan As TimeSpan
tsTimeSpan = Now.Subtract(dtStartDate)
iNumberOfDays = tsTimeSpan.Days 'Where iNumberOfDays is the result of the timespan
它完美,当我的电脑时间格式为
DD-MMM-YY计算在vb.net的时间跨度(在控制面板>日期和时间>更改日期和时间>更改日历设置>日期格式中找到)
如果更改计算机日期格式是这样的MM/DD/YY,我的应用程序提供了错误的线
昏暗dtStartDate截止日期= “17/12/2032”
的错误是“从字符串“17/12/2032”转换为输入日期无效。
我需要计算所有日期格式的时间跨度。如何解决问题?
感谢。这真的很有用:) –