add_delta_days: 30.06.2006 +1 Day = 01.07.2006?
add_delta_days: 30.06.2006 +1 Day = 01.07.2006?
am 30.07.2006 22:40:04 von thomas.reiss
Hi,
attention, Beginner!
I'm wondering about the calculation from Modul Date::Calc.
The Code:
sub ids_tomorrow() {
my($year,$month,$day) = Add_Delta_Days(((localtime)[5,4,3]),1);
$year=$year+1900;
printf("Id's, tommorow: %02d.%02d.%04d\n",$day,$month,$year);
}
give me (called on 30.06.2006) as Resoult the Date 01.07.2006?
It should be 31.06.2006.
What made i wrong?
"Date::Calc" version 5.4
Perl: Ver. 5.8.8
Thanx for Help
Thomas
Re: add_delta_days: 30.06.2006 +1 Day = 01.07.2006?
am 30.07.2006 23:38:52 von Mark Clements
thomas.reiss@gmx.de wrote:
> Hi,
>
> attention, Beginner!
>
> I'm wondering about the calculation from Modul Date::Calc.
>
> The Code:
>
> sub ids_tomorrow() {
> my($year,$month,$day) = Add_Delta_Days(((localtime)[5,4,3]),1);
> $year=$year+1900;
> printf("Id's, tommorow: %02d.%02d.%04d\n",$day,$month,$year);
> }
>
> give me (called on 30.06.2006) as Resoult the Date 01.07.2006?
> It should be 31.06.2006.
> What made i wrong?
>
> "Date::Calc" version 5.4
> Perl: Ver. 5.8.8
>
June only has 30 days.
Mark
Re: add_delta_days: 30.06.2006 +1 Day = 01.07.2006?
am 31.07.2006 14:23:46 von thomas.reiss
Mark Clements schrieb:
> thomas.reiss@gmx.de wrote:
> > Hi,
> >
> > attention, Beginner!
> >
> > I'm wondering about the calculation from Modul Date::Calc.
> >
> > The Code:
> >
> > sub ids_tomorrow() {
> > my($year,$month,$day) = Add_Delta_Days(((localtime)[5,4,3]),1);
> > $year=$year+1900;
> > printf("Id's, tommorow: %02d.%02d.%04d\n",$day,$month,$year);
> > }
> >
> > give me (called on 30.06.2006) as Resoult the Date 01.07.2006?
> > It should be 31.06.2006.
> > What made i wrong?
> >
> > "Date::Calc" version 5.4
> > Perl: Ver. 5.8.8
> >
>
> June only has 30 days.
>
> Mark
Upps, sorry my mistake, i live at the wrong Month ;-)
The Skript was not called on 06/2006 but on 07/2006!
But Your hint was very usefull.
localtime returns the month beginning with 0 for January,
Add_Delta_Days await the January with 1 !
so i have to add 1 to $month.
Thank's for help
Thomas