I have a string 2020-09-18T07:58:03-04:00 which i want to convert into timestamp format before storing to database. anyone can help me with this?
2 Answers
You can do
Carbon::parse('2020-09-18T07:58:03-04:00')->toDateTimeString();
// OR
Carbon::parse('2020-09-18T07:58:03-04:00')->format('Y-m-d H:i:s');
Result: 2020-09-18 07:58:03
2 Comments
yasir_tetralogicx
Actually i want to get a timestamp like this 2020-09-22 14:59:11
mmabdelgawad
2020-09-22 14:59:11 This is not timestamp check the update answer
date('d -m -Y',strtotime('2020-09-18T07:58:03-04:00'))..date('Y -m -d',strtotime('2020-09-18T07:58:03-04:00'))