in reply to How do I convert seconds into a readable time?
sub dhms2sec { my $in = shift; $in =~ s/(and|,)//g; $in =~ s/(\w+)s/\1/g; my %y = reverse split(/\s+/,$in); return ($y{'second'}) + ($y{'minute'} * 60) + ($y{'hour'} * 60*60) + ($y{'day'} * 60*60*24); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: How do I convert seconds into a readable time?
by blakem (Monsignor) on Aug 04, 2001 at 04:03 UTC |