From the mIRC helpfile:
$duration(seconds,N)
Returns the specified number of seconds in a week/day/hour/minute/second format.
The N parameter is optional. If N = 2, the result does not include the seconds value. If N = 3, the result is in h:m:s format.