On Oct 23, 2:19 pm, [EMAIL PROTECTED] wrote:
> Hi
>
> Thaks for ur valuable info..........
>
> my code is
>
> my $total_nights="3";
> $total_nights = "0".$total_nights if ((!($total_nights =~
> /^0/)) && ($total_nights < 10));
> my $start_date="2008-03-24";
> my ($year,$mon,$day) = split/-/,$start_date;
>                        $day=($day+$total_nights);
>                        my @data =("$year","$mon","$day");
>                         my $departure_date= join("-",@data);
>
> but it makes issues on Feb and end of the
> months........Any comments???
>
> Thanks,
> Boniface........

Date is one complex thing to handle on itself, when you want to
manipulate it ... There are modules to make it simple....
I would suggest you Date::Calc module

##############
use strict;
use warnings;
use Date::Calc qw(Add_Delta_Days);

my ($y,$m,$d) = (2007,7,12);
$total_nights = 3;
($y,$m,$d) = Add_Delta_Days($y,$m,$d,$total_nights);

######

>From whatever I have read to be you requirement this would work fine
for you....





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to