更新工作守則 添加以下代碼一部分報告
Public Function TimeSpanToString(source as Timespan) as String
Dim result As String
result = Convert.ToInt32(source.TotalHours).ToString() & ":" & source.Minutes.ToString() & ":" & source.Seconds
return result
End Function
下面是一個例子了答案:TimeSpan.FromHours Method。
更新:
static string TimeSpanToString(TimeSpan source)
{
string result = string.Format("{0}:{1}:{2}",
(int)source.TotalHours,
source.Minutes,
source.Seconds);
return result;
}
更新: 不知道它是否是正確的,但請嘗試以下 格式爲「64:10:12」,可以用下面的代碼來完成使用它從RDLC:
public class SomeClass
{
public TimeSpan Time { get; set; }
public string FormattedTime
{
get { return TimeSpanToString(Time); }
}
private static string TimeSpanToString(TimeSpan source)
{
// Code.
}
}
然後嘗試從報告"=Fields!FormattedDate.Value"
得到它。
[Standard TimeSpan Format Strings](http://msdn.microsoft.com/zh-cn/library/ee372286.aspx)&[Custom TimeSpan Format Strings](http://msdn.microsoft.com/zh-cn/我/圖書館/ ee372287.aspx) – dtb 2012-02-07 16:58:32