.------[ James Parsons wrote (2002/11/12 at 09:22:00) ]------
 | 
 |  Good Morning all   
 |  
 |  Since I'm still a Newbie when it comes to Perl , so my question may sound
 |  fairly simple to the group but here goes..
 |  
 |  I need to create a  file that has the localtime  - 1 day and -2 days. and
 |  then redirect this to 2 separate files. 
 |  
 `-------------------------------------------------

    I would suggest getting the Date::Calc module from cpan.org. With it
    you can do simple date manipulations easily. The documentation is
    pretty straight forward, but here is what the code would be (untested):

    use Date::Calc qw(Today_and_Now Add_Delta_Days Mktime); 

    # Get current day/time 
    my @time_values = Today_and_Now(); 

    # Get current - 1 day 
    my @minus_one = Add_Delta_DHMS(@time_values, -1, 0, 0, 0); 

    # Get current - 2 days 
    my @minus_two = Add_Delta_DHMS(@time_values, -2, 0, 0, 0); 

    # Turn Date::Calc representations into epoch seconds for localtime()
    my $day_one = Mktime(@minus_one); 
    my $day_two = Mktime(@minus_two); 

    # Get localtime strings 
    my $localtime_minus_one = localtime($day_one); 
    my $localtime_minus_two = localtime($day_two); 

    I hope that makes sense.

 ---------------------------------
   Frank Wiles <[EMAIL PROTECTED]>
   http://frank.wiles.org
 ---------------------------------


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to