Help for this page

Select Code to Download


  1. or download this
    >perl -MTime::Duration -e "print duration_exact(1332443)"
    15 days, 10 hours, 7 minutes, and 23 seconds
    
  2. or download this
    >perl -MTime::Duration -e "print duration(1332443)"
    15 days and 10 hours
    
  3. or download this
    my $d  = int( $seconds / 86400 );
    my $h  = int( ($seconds - $d*86400)           /  3600 );
    my $m  = int( ($seconds - $d*86400 - $h*3600) /    60 );
    my $s  = $seconds % 60;
    print "$d days, $h hours, $m min, $s sec\n";
    
  4. or download this
    my $day_string = $d > 1 ? 'days' : 'day';