Add wrapper function for formatting datetime

This makes it easier to use and correctly converts params which
formatTime expects.