日期:2014-05-18 浏览次数:20854 次
///<summary> ///返回所需時間的完整格式 xx天xx小時xx分鐘xx秒 ///</summary> ///<param name="seconds">總共所需的秒數</param> public string LeftTimeFormat(int seconds) { string s = ""; if (seconds / (3600 * 24) > 0) { s += seconds / (3600 * 24) + "天"; seconds = seconds % (3600 * 24); } if (seconds / 3600 > 0) { s += seconds / 3600 + "小時"; seconds = seconds % 3600 ; } if (seconds / 60 > 0) { s += seconds / 60 + "分鐘"; seconds = seconds % 60; } s += seconds + "秒"; return s; }