Fix bug in date formatting (thanks Mike R)