Export time duration formatting function, so that it can be used from UI