C#毫秒转时分秒格式

  1. private string RevertToTime(int l)//转换为时分秒格式
  2. {
  3. string str = "";
  4. int hour = 0;
  5. int minute = 0;
  6. int second = 0;
  7. second = l / 1000;
  8. if (second > 60)
  9. {
  10. minute = second / 60;
  11. second = second % 60;
  12. }
  13. if (minute > 60)
  14. {
  15. hour = minute / 60;
  16. minute = minute % 60;
  17. }
  18. return (hour.ToString() + ":" + minute.ToString() + ":"
  19. + second.ToString());
  20. }





posted @ 2016-03-01 16:56  Lucas_1993  阅读(2535)  评论(0编辑  收藏  举报