for $seconds(3598 .. 3661) {
  $_=gmtime $seconds;/(\d\d):(\d\d):(\d\d)/;
  0+$1 && printf "%d hour ",$1;
  0+$2 && printf "%d minutes",$2;
  0+$3 && (($1 || $2) && print (" and "),printf "%d seconds",$3);print "\n"
}
give me:
---------- Perl ----------
59 minutes and 58 seconds
59 minutes and 59 seconds
1 hour 
1 hour  and 1 seconds
1 hour  and 2 seconds
1 hour  and 3 seconds
1 hour  and 4 seconds
1 hour  and 5 seconds
1 hour  and 6 seconds
1 hour  and 7 seconds
1 hour  and 8 seconds
1 hour  and 9 seconds
1 hour  and 10 seconds
1 hour  and 11 seconds
1 hour  and 12 seconds
1 hour  and 13 seconds
1 hour  and 14 seconds
1 hour  and 15 seconds
1 hour  and 16 seconds
1 hour  and 17 seconds
1 hour  and 18 seconds
1 hour  and 19 seconds
1 hour  and 20 seconds
1 hour  and 21 seconds
1 hour  and 22 seconds
1 hour  and 23 seconds
1 hour  and 24 seconds
1 hour  and 25 seconds
1 hour  and 26 seconds
1 hour  and 27 seconds
1 hour  and 28 seconds
1 hour  and 29 seconds
1 hour  and 30 seconds
1 hour  and 31 seconds
1 hour  and 32 seconds
1 hour  and 33 seconds
1 hour  and 34 seconds
1 hour  and 35 seconds
1 hour  and 36 seconds
1 hour  and 37 seconds
1 hour  and 38 seconds
1 hour  and 39 seconds
1 hour  and 40 seconds
1 hour  and 41 seconds
1 hour  and 42 seconds
1 hour  and 43 seconds
1 hour  and 44 seconds
1 hour  and 45 seconds
1 hour  and 46 seconds
1 hour  and 47 seconds
1 hour  and 48 seconds
1 hour  and 49 seconds
1 hour  and 50 seconds
1 hour  and 51 seconds
1 hour  and 52 seconds
1 hour  and 53 seconds
1 hour  and 54 seconds
1 hour  and 55 seconds
1 hour  and 56 seconds
1 hour  and 57 seconds
1 hour  and 58 seconds
1 hour  and 59 seconds
1 hour 1 minutes
1 hour 1 minutes and 1 seconds

Mit freundlichen Grüssen 
Joachim Görner 

Informationsverarbeitung Systemtechnik Basisdienste (ISB) 
ADAC e.V., Am Westpark 8, 81373 München 
Tel.: (089) 76 76 27 83 Fax: (089) 76 76 28 82 
<mailto:[EMAIL PROTECTED]> 
www.adac.de 



> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Gesendet: Dienstag, 2. November 2004 19:02
> An: [EMAIL PROTECTED]
> Betreff: Formatting seconds help
> 
> 
> Does anyone have a simple routine or a way that I can
> format my seconds. Say I have:
> 
> $seconds = '3600';
> I want the output to say "1 hour"
> 
> $seconds = '5567';
> I want the output to say "1 hour 54 minutes and 64 seconds"
> 
> Something like that that will break down the amount of
> days, hours, minutes, and seconds.
> 
> Thank you
> Allan
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to