本帖最後由 葉桔良 於 2022-6-18 16:00 編輯
將輸入的秒數, 換算成幾週, 幾天, 幾小時, 幾分鐘, 幾秒.
- weeks=seconds/60/60/24/7;
- days=seconds/60/60/24-weeks*7;
- hours=(seconds-days*24*60*60-weeks*7*24*60*60)/60/60;
- minutes=(seconds-weeks*7*60*24*60-days*24*60*60-hours*60*60)/60;
- seconds=seconds-minutes*60-hours*60*60-days*60*60*24-weeks*60*60*24*7;
複製代碼 |