improved date formatting with inspiration from strconv