Transform seconds into an array of days, hours, minutes, etc

time:seconds_to_days_hours_and_minutes(INT $seconds) : ARRAY

time:seconds_to_days_hours_and_minutes(60)
#=> [
#=>     "day" => 0,
#=>     "hour" => 0,
#=>     "minute" => 1,
#=>     "second" => 0
#=> ]

time:seconds_to_days_hours_and_minutes(2398)
#=> [
#=>     "day" => 0,
#=>     "hour" => 0,
#=>     "minute" => 39,
#=>     "second" => 58
#=> ]

time:seconds_to_days_hours_and_minutes(-2398)
#=> [
#=>     "day" => 0,
#=>     "hour" => 0,
#=>     "minute" => 39,
#=>     "second" => 58
#=> ]

time:seconds_to_days_hours_and_minutes(0)
#=> [
#=>     "day" => 0,
#=>     "hour" => 0,
#=>     "minute" => 0,
#=>     "second" => 0
#=> ]

Copyright ©2013-2022 SunSed®. All rights reserved.