毫秒数转换为时间计时天数 您所在的位置:网站首页 怎么计算出天数 毫秒数转换为时间计时天数

毫秒数转换为时间计时天数

2023-06-23 02:48| 来源: 网络整理| 查看: 265

//按天计时 public static String CountTime1(long time) { long days = time/ (1000 * 60 * 60 * 24); long hours = (time% (1000 * 60 * 60 * 24)) / (1000 * 60 * 60); long minutes = (time% (1000 * 60 * 60)) / (1000 * 60); long seconds = (time% (1000 * 60)) / 1000; return days + " 天 " + hours + "小时 "+ minutes +" 分钟 "+seconds +"秒"; } //按小时计时 public static String CountTime2(long time) { long hours = time/ (1000 * 60 * 60); long minutes = (time% (1000 * 60 * 60)) / (1000 * 60); long seconds = (time% (1000 * 60)) / 1000; return hours + "小时 "+ minutes +" 分钟 "+seconds +"秒"; } //按分钟计时 public static String CountTime3(long time) { long minutes = time / (1000 * 60); long seconds = (time% (1000 * 60)) / 1000; return minutes +" 分钟 "+seconds +"秒"; } 以及mysql日期语句 上个月的第一天:

select date_sub(date_sub(date_format(now(), ‘%y-%m-%d’), interval extract(day from now()) - 1 day), interval 1 month);

上个月的最后一天:

select date_sub(date_sub(date_format(now(), ‘%y-%m-%d’), interval extract(day from now()) day), interval 0 month);

这个月的第一天:

select date_sub(date_sub(date_format(now(), ‘%y-%m-%d’), interval extract(day from now()) - 1 day), interval 0 month);

这个月的最后一天:

select date_sub(date_sub(date_format(now(), ‘%y-%m-%d’), interval extract(day from now()) day), interval - 1 month);



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有