added an option to set the date format