$Bill Luebkert wrote:

> sekhar kavuru wrote:
> 
> 
>>I need help with a generic function that can give the value of next day
>>Example : 12/31/2005 => 01/01/2006
>> 
>>I want to accomplish this without Cal::Date
> 
> 
> use strict;
> use warnings;
> use Time::Local;
> 
> my @t = localtime;                    # get epoch time for today
> $t[0] = 0; $t[1] = 0; $t[2] = 12;     # drop H:M:S back to noon

My mistake.  You want to add the day in epoch form:

my $time = timelocal (@t) + 86400;      # convert to epoch time and add a day

> # Now you can use one of these for the rest:
> 
> @t = localtime $time;
> my $file = sprintf "%02u/%02u/%04u", $t[4]+1, $t[3], $t[5]+1900;
> print $file, "\n";
> 
> use POSIX;
> @t = localtime $time;
> $file = strftime "%m/%d/%Y", @t;
> print $file, "\n";


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to