Search code examples
phplaravellaravel-5php-carbon

How could i create carbon object from given datetime structure?


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 ?


Solution

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