added function for converting dates to datetime format