将分钟转换为小时,分钟和秒 [英] Convert minutes to hours, minutes and seconds

查看:83
本文介绍了将分钟转换为小时,分钟和秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的界面中,我让用户输入X分钟的时间,他们可以暂停操作.

Im my interface I'm letting the user input X amount of minutes that they can pause an action for.

如何将其转换为小时,分钟和秒钟?

How can i convert that into hours, minutes and seconds?

我需要它来更新倒计时标签以向用户显示剩余时间.

I need it to update the countdown labels to show the user the time left.

推荐答案

首先创建TimeSpan,然后将其格式化为所需的任何格式:

First create TimeSpan and then format it to whatever format you want:

TimeSpan span = TimeSpan.FromMinutes(minutes);
string label = span.ToString(@"hh\:mm\:ss");

这篇关于将分钟转换为小时,分钟和秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆