in reply to Time Formatting....

One way to do it yourself would be:
# 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
    In addition to those modules I would recommend taking a look at Date::Format. It may not have as many features as the other ones, but for simple formatting like you are wanting to do it is very easy and straightforward to use. Also included in that distribution is Date::Parse which can be used to parse simple dates which I find useful for when you are fairly certain what format a date will be entered in but want to be a little flexible with the user.