thor has asked for the wisdom of the Perl Monks concerning the following question:
I've come up with a hack that given a floating point number like 1.1, returns the hours, minutes, and seconds.#want 1.1 hours from now print join(" ",Add_Delta_DHMS(Today_and_Now, 0, 1.1, 0, 0); print join(" ",Add_Delta_DHMS(Today_and_Now, 0, 1, 0, 0); #prints the same thing!!!
Is there a better way?sub hms { my ($hours) = @_; my $minutes = ($hours - int($hours)) * 60; my $seconds = ($minutes - int($minutes)) * 60; return(int($hours), int($minutes), int($seconds)); }
thor
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fractional times in Date::Calc
by liz (Monsignor) on Aug 12, 2003 at 18:48 UTC | |
|
Re: Fractional times in Date::Calc
by fglock (Vicar) on Aug 13, 2003 at 02:15 UTC | |
|
Re: Fractional times in Date::Calc
by Cody Pendant (Prior) on Aug 12, 2003 at 23:43 UTC | |
by thor (Priest) on Aug 13, 2003 at 05:10 UTC | |
by Cody Pendant (Prior) on Aug 13, 2003 at 05:23 UTC |