How could i create carbon object from given datetime structure?

Shankar Thiyagaraajan picture Shankar Thiyagaraajan · Dec 20, 2016 · Viewed 14.5k times · Source

I use laravel, i need to create carbon object from the timestamp that i received.

TimeStamp : 'yy-mm-dd HH:mm'

ex. '2016-12-20 10:26'

Is this possible ?

Or Any other solution ?

Answer

SteD picture SteD · Dec 20, 2016

Use Carbon::parse('2016-12-20 10:26');, it will return a Carbon object.