Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel seconds to hours minutes seconds

$value = '90060';
$dt = Carbon::now();
$days = $dt->diffInDays($dt->copy()->addSeconds($value));
$hours = $dt->diffInHours($dt->copy()->addSeconds($value)->subDays($days));
$minutes = $dt->diffInMinutes($dt->copy()->addSeconds($value)->subDays($days)->subHours($hours));
echo CarbonInterval::days($days)->hours($hours)->minutes($minutes)->forHumans();
Comment

time left laravel seconds

//seconds and human time readable
$endTime = Carbon::parse("2021-09-23 19:15:16");
$startTime = Carbon::parse("2021-09-23 19:15:14");
$timeleft = $startTime->diffForHumans($endTime);
return $timeleft;
//output => time_left: "2 second before"
Comment

PREVIOUS NEXT
Code Example
Php :: php days in month 
Php :: how to add values to an array in laravel 
Php :: laravel session 
Php :: wordpress register post type 
Php :: laravel run migration specific file 
Php :: php get current dir mac 
Php :: php get keys and values from array 
Php :: php foreach random 
Php :: eloquent with 
Php :: php join array with comma 
Php :: download file php 
Php :: add two numbers as string in php 
Php :: phpexcel set data type string 
Php :: php return a json response 
Php :: PHP Read File modes 
Php :: php absolute value 
Php :: laravel delete controller still cached 
Php :: check if string starts with php 
Php :: current user wordpress 
Php :: session laravel 
Php :: laravel empty query result 
Php :: Carbon Add Hours In Laravel 
Php :: laravel make auth 
Php :: how to share a helper globally laravel 
Php :: convert any phone number in us number format php 
Php :: php array extract value 
Php :: laravel blade empty 
Php :: update user role wordpress 
Php :: migrate specific file in laravel 
Php :: laravel create new request 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =