I have a field representing an elapsed time in seconds. I can't see to find a way to format the string as mm:ss.fff, In c# I'd just use Timespan.FromSeconds and use format to get what I;d like.
I'm looking for an report expression equivalent of:
static public string FormatLapTime(double timeInSeconds)
{ TimeSpan t = TimeSpan.FromSeconds(timeInSeconds);
return string.Format("{0:D2}:{1:D2}.{2:D3}", t.Hours * 60 + t.Minutes, t.Seconds, t.Milliseconds); }
Each record in my table has an elapsed time. Each elapsed time is made up of several segments, each with their own elapsed time. Ideally I'd like to use the reporting tool to help determine the maximum elapsed time for each segment, sum them together and display the potential longest time in the mm:ss.fff format, as detailed above.
Any ideas on how to make this happen?
Hello,
I am just checking if you require any further assistance on the matter.
According to the TimeSpan format info from MS, the format string only displays the number of minutes from 0-59, my goal is to display the minutes if the process takes over an hour to display so the minutes should display (hours * 60) + minutes. It's very very rare that a task takes more then an hour so I don't want to include an hours field in each column.
The suggestion is a help, but not precisely what I am looking for.
Any ideas?
Hi,
Thank you for your reply. I have been looking into your requirement and in order to display a TimeSpan field in the desired format I can suggest you use the following expression:
=Fields.Duration.Hours * 60 + Fields.Duration.Minutes +":" + Fields.Duration.Seconds.ToString("00") +":" + Fields.Duration.Milliseconds.ToString("00")
where ‘Duration’ is the name of the property from the underlying data.
I am attaching a sample application(SimpleReportWPF.zip) that shows this approach.
Let me know, if you need any further assistance on this matter.