in reply to Calculating between times

I will try to reask my questions in a better way..

Question 1) How can I get localtime() to print the day, month and year in this format 01.08.04 (if the day or month is less than 10, have a leading zero).

Question 2) After localtime is in it's nice little format, how do I check it against an already saved $time to determine if the date has already passed? I need to make it detect whether or not the saved date is more than a week old.

Thanks again

Replies are listed 'Best First'.
Re: Re: Calculating between times
by Roy Johnson (Monsignor) on Jan 08, 2004 at 19:12 UTC
    1. $formatted = sprintf '%.02d.%.02d.%.02d', $mon, $day, $yr
      assuming you've already adjusted for $mon counting from zero
    2. You could convert back to seconds using timelocal and see if there's more than 24*60*60*7 seconds' difference.

    The PerlMonk tr/// Advocate