20131620
20131620

Reputation: 1

Total time to HH:MM:SS in RDLC

this is the code i have right now. This code computes the total time in my rdlc using expressions.

 System.TimeSpan.FromTicks(Sum(system.TimeSpan.Parse(Fields!Number_of_Hours.Value)))

this code shows days,hours and minutes.

What I want to see is this

113:37:00

How can I achieve it? Is it possible?

Upvotes: 0

Views: 1649

Answers (2)

Gopal Dey
Gopal Dey

Reputation: 1

Try this , You have to add this expression in your report =TimeSpan.FromTicks(Sum(TimeSpan.Parse(Fields!DurationTime.Value)))

Upvotes: 0

Ulugbek Umirov
Ulugbek Umirov

Reputation: 12797

Unfortunately TimeSpan doesn't support such formatting (output total hours), so you have to do it manually:

TimeSpan ts = new TimeSpan(113, 37, 0);
string s = string.Format(@"{0}:{1:mm\:ss}", (int)ts.TotalHours, ts);

Upvotes: 1

Related Questions