【问题标题】:SSRS 2005 display seconds in HH:MM:SS for durations greater than 24 hoursSSRS 2005 以 HH:MM:SS 显示秒数,持续时间超过 24 小时
【发布时间】:2011-08-04 19:09:31
【问题描述】:

首先感谢大家的帮助!!!

我要做的只是获取一些在 SSRS 2005 中工作的 VB.net 代码,以将 123465 显示为 34:17:45。

这是我迄今为止尝试过的:

Public Shared Function secondsToString(seconds As int64) As String
Dim myTS As New TimeSpan(seconds * 10000000)
If seconds > 0 then
  Return String.Format("{0:00}:{1:00}:{2:00}",myTS.Hours, myTS.Minutes, myTS.Seconds)
Else
  Return ""
End if
End Function

您能提供的任何帮助都会很棒!

再次感谢!

【问题讨论】:

  • 添加到问题中,谢谢!

标签: vb.net timestamp ssrs-2008 reportingservices-2005 reporting-services


【解决方案1】:
Public Shared Function secondsToString(seconds As int64) As String
Dim myTS as new TimeSpan(seconds * 10000000)
If seconds > 0 then
  Return String.Format("{0:HH\\:mm\\:ss}",seconds)
Else
  Return ""
End if
End Function

【讨论】:

  • 谢谢!但这似乎不起作用。它表示对 TimeSpan 的强制转换无效。
【解决方案2】:
Public Shared Function secondsToString(seconds As int64) As String
   Dim myTS As New TimeSpan(seconds * 10000000)
   If seconds > 0 then
     Return String.Format("{0:00}:{1:00}",myTS.TotalHours, myTS.Minutes)
   Else
     Return ""
   End if
End Function

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-01
    • 2012-12-08
    • 1970-01-01
    相关资源
    最近更新 更多