Adding current time to date via Carbon
I watched a video on here a while ago where Jeffrey did this but cannot find it.
I have a timestamp field but I only want the user to select the date and store an item.
Trouble is a user may store 2 or 3 items on the same day so I want to automatically add the time as I want to be able to sort them by most recent.
There was a simple way of doing this via Carbon, anyone know what it is?
Laravel will pull out a date as a Carbon instance through Eloquent. If you want to change a raw timestamp to get just the time, then
$dt = Carbon::create(1975, 12, 25, 14, 15, 16); // or Carbon::now()
$dt->toTimeString(); // 14:15:16
Please or to participate in this conversation.