I have a table with column seconds, where I insert online time (in seconds),
Carbon::parse($seconds)->forHumans();
Doesnt allow me to do this, there is a way to parse seconds and transfer it to humans reading? like 1 hour or 2 weeks?
This should return the result you're after:
Carbon::now()->subSeconds($seconds)->diffForHumans();
Try this:
Carbon Time in Human readable format
// $sec will be the value from your seconds table
echo Carbon::now()->addSeconds($sec)->diffForHumans();
// OR
echo Carbon::now()->subSeconds($sec)->diffForHumans();
Output
// if $sec = 5
5 seconds from now
Found this useful doc Carbon
Hope this is helpful.
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