分钟或秒转换为时分秒的程序
来源:互联网 发布:时 分转换成时间戳java 编辑:程序博客网 时间:2024/05/16 05:37
最近写了个分钟或秒转换为时分秒的程序,分享一下
//将分钟转换为时分的格式 public static string GetFormatTimeFromMinutes(int minutes) { int day = (int)Math.Floor(Convert.ToDouble(minutes / 1440)); int hour = day > 0 ? (int)Math.Floor(Convert.ToDouble((minutes - day * 1440) / 60)): (int)Math.Floor(Convert.ToDouble(minutes / 60)); int minute = hour > 0 ? minutes - day * 1440 - hour * 60 : minutes; string time = ""; if (day > 0) time += day + "天"; if (hour > 0) time += hour + "小时"; if (minute > 0) time += minute + "分钟"; return time; } //将秒转换为时分的格式 public static string GetFormatTimeFromSeconds(int seconds) { int day = (int)Math.Floor(Convert.ToDouble(seconds / 86400)); int hour = day > 0 ? (int)Math.Floor(Convert.ToDouble((seconds - day * 86400) / 3600)) : (int)Math.Floor(Convert.ToDouble(seconds / 3600)); int minute = hour >= 0 ? (int)Math.Floor(Convert.ToDouble(seconds - day * 86400 - hour * 3600)/60) : seconds; int second = minute >= 0 ? seconds - day * 86400 - hour * 3600- minute * 60 : seconds; string time = ""; if (day > 0) time += day + "天"; if (hour > 0) time += hour + "小时"; if (minute > 0) time += minute + "分钟"; if (second > 0) time += second + "秒"; return time; }
0 0
- 分钟或秒转换为时分秒的程序
- 把秒转换为时分秒
- 把秒转换为时分秒
- js将秒转换为时分秒的格式
- 在JS中将秒数转换为时分秒
- 时间戳转换为时分秒
- js 将秒转化为时分秒
- Java中整数(秒数)转换为时分秒格式(xx:xx:xx)
- Java中整数(秒数)转换为时分秒格式(xx:xx:xx)
- Java中整数(秒数)转换为时分秒格式(xx:xx:xx)
- Java中整数(秒数)转换为时分秒格式(xx:xx:xx)
- 秒转化为时分秒,时分秒转化为秒
- javascript将秒数转换为时分秒格式
- Excel中秒数转换为时分秒格式字符串
- 将毫秒数转换为时分秒
- ORACLE如何将6位时间转换为时分秒格式
- 将秒数转化为时分秒
- 将秒数转化为时分秒
- 配置ExtJS及使用其他框架
- Android面试题
- mybatis向mysql插入含有逗号的值报错
- placeholder—Jquery插件placeholder的使用方法
- Best Time to Buy and Sell Stock III
- 分钟或秒转换为时分秒的程序
- 六个方面对360网站卫士与百度加速乐的比较
- Java类集List中subList()中的一个Demo解析
- 快速排序,归并排序,堆排序python实现
- CSDN博客排名第一第二的人的文章,可能不是你真正需要的。
- OCP 1Z0 053 136
- hdu1173 采矿
- 方法覆盖
- C++编译重复代码消除