How can I String.Format a TimeSpan object with a custom format in .NET?

后端 未结 19 1449
情深已故
情深已故 2020-11-22 12:25

What is the recommended way of formatting TimeSpan objects into a string with a custom format?

19条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 12:45

    Dim duration As New TimeSpan(1, 12, 23, 62)
    
    DEBUG.WriteLine("Time of Travel: " + duration.ToString("dd\.hh\:mm\:ss"))
    

    It works for Framework 4

    http://msdn.microsoft.com/en-us/library/ee372287.aspx

提交回复
热议问题