in reply to Time Formatting....
# assuming $_session_time is in seconds. my $_session_time = $session{time_then}; my $_current_time = time(); my $_time_now = ($_current_time-$_session_time); my $minutes = int($_time_now / 60); my $seconds = $_time_now % 60;
Though this will likely fail during time changes if they are observed where this code is being run.
Alternatives include DateTime, Date::Calc, and Date::Manip.
Code lightly tested. "It works for me."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Time Formatting....
by Mr_Person (Hermit) on Aug 04, 2003 at 18:55 UTC |