add function to convert time to date format