parse and format timespans