I have date time like 2017-07-23 10:05:50
but i need 2017-07-23T10:05:50-05:00
I have try with --
date('Y-m-dTH:i:s', strtotime($old_date)); // Return : 2017-07-23CEST10:26:41
But this is not valid https://validator.w3.org/feed/docs/error/InvalidW3CDTFDate.html
Try with this code:
date('c', strtotime($old_date));