0

I have a date string returned from Go Cardless Api in the format of "2017-03-29T09:46:35.937Z" I want to just keep the Y-m-d H:i:s part and to remove the T and remove everything after the seconds. I have been looking around at the php docs and I think DateTime::createFromFormat should be able to do this but I cant find any good examples anywhere

gibbles
  • 26
  • 4

1 Answers1

0

One option would just be to use the substr(...); function.

$yourdatestring = substr($yourdatestring, 0, 10) . ' ' . substr($yourdatestring, 11, 8);

Sam W
  • 13
  • 1
  • 6