$duration

From Scriptwiki
Revision as of 09:16, 25 August 2005 by BlackShroud (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Converts an interval (unit: seconds) into a human-readable format.

$duration(interval, N)

$duration(3660) returns "1hr 1min".

N is an optional parameter which specifies how $duration formats the time:

NMeaning
2do not include seconds in the result
3$duration uses the H:m:s format

Examples

Time since a specific date

echo -a $duration($calc($ctime - $ctime(10.02.1986 00:00)))

This command echos how much time has passed since the 10th February 1086.