function to display date and format