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 ?
Use Carbon::parse('2016-12-20 10:26');
, it will return a Carbon
object.
You can use parse()
:
Carbon::parse($dateString);
Or you can use $dates
property to create Carbon instance automatically for the column:
protected $dates = ['custom_date'];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With