Link to home
Start Free TrialLog in
Avatar of rgbcof
rgbcof

asked on

How to get days, hours, minutes, seconds from a large seconds value.

$num_of_seconds = 172870;

#how to get dd days, hh hours, mm minutes, and ss seconds?  So it will be like 2 days 0 hours 1 minutes 10 seconds.
ASKER CERTIFIED SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
#or
my $num_of_seconds = 172870;
my($ss,$mm,$hh,$dd)=(gmtime $num_of_seconds)[0,1,2,7];   #but this only works up to 364 days
#the simplest way to extend it beyond 364 days may be to add another variable.