I have datetime string: 2016-11-01 15:04:19
How I can get date and time separated?
Carbon comes with multiple setters
and getters
.
http://carbon.nesbot.com/docs/#api-getters
If you have a datetime string and you want to use it with a Carbon
instance you can do:
$date = \Carbon\Carbon::parse('2016-11-01 15:04:19');
Then you can do something like:
$date->format('Y-m-d')
$date->format('H:i:s')
That being said, if you are getting this datetime from an Eloquent
model then you should look at @AlexeyMezenin or @Christophvh answer.
Hope this helps!