Perform datetime formatting