Add format function to convert from a datetime tuple