秒数转换为天小时分钟秒的格式

  • num 为需要转换的秒数
    //天数计算
    int days = (num)/(24*3600);

    //小时计算
    int hours = (num)%(24*3600)/3600;

    //分钟计算
    int minutes = (num)%3600/60;

    //秒计算
    int second = (num)%60;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11


猜你喜欢

转载自blog.csdn.net/chenyao1994/article/details/80599442
今日推荐