我有一个时间跨度,ts大多数是分钟和秒,但有时是几个小时.我想ts返回一个格式化的字符串,它会给出以下结果:
3:30 (hours not displayed, showing only full minutes)
13:30
1:13:30 (shows only full hours instead of 01:13:30)
Run Code Online (Sandbox Code Playgroud)
到目前为止,我有:
string TimeSpanText = string.Format("{0:h\\:mm\\:ss}", MyTimeSpan);
Run Code Online (Sandbox Code Playgroud)
但它没有给出上述结果.我怎样才能达到我想要的效果?