in reply to Convert seconds into a formatted ddd:hh:mm:ss string
Or perhaps slightly more sanely as$string = join ":", map { sprintf "%02d", $_ } (gmtime($seconds))[7, +2,1,0];
If you want to strip the string then run this on it$string = sprintf "%02d:%02d:%02d:%02d", (gmtime($seconds))[7,2,1,0] +;
This regexp idea came from merlyn via Effective Perl$string =~ s/\G00://g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Convert seconds into a formatted ddd:hh:mm:ss string
by merlyn (Sage) on Aug 31, 2000 at 14:46 UTC |