added function to format dates