模組:Duration/doc

维基百科,自由的百科全书

这是Module:Duration的文档页面

The module is meant for language-dependant time calculations.

It exports a single function: sumHMS, which accepts unnamed (aka "order based") arguments in the form ssss (any number of digits) or "mm:ss" or "hh:mm:ss:, sums up all the periods, and returns the output string describing the total duration.

An optional paramter, "units" controls the format of the output.

例子[编辑]

  • {{#invoke:Duration | sumHMS | 7211 | units = minutes, seconds}}得到“120分11秒”。
  • {{#invoke:Duration |sumHMS | 1:0:11 | 1:00:00 | units= seconds}}得到“7,211秒”。
  • {{#invoke:Duration | sumHMS | 10:10:10 | 20:20:20 | 12:13:14 }}得到“1天18小时43分44秒”。