Convert ToString to time format C#

Posted by Michael Quiles on Stack Overflow See other posts from Stack Overflow or by Michael Quiles
Published on 2010-04-26T21:10:30Z Indexed on 2010/04/26 21:13 UTC
Read the original article Hit count: 135

Filed under:

Time.ToString("0.0") shows up as a decimal "1.5" for instead of 1:30 how can I get it to display in a time format.

private void xTripSeventyMilesRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            //calculation for the estimated time label
            Time = Miles / SeventyMph; 
            this.xTripEstimateLabel.Visible = true;
            this.xTripEstimateLabel.Text = "Driving at this speed the estimated travel time in hours is: " + Time.ToString("0.0") + " hrs";
        }

© Stack Overflow or respective owner

Related posts about c#