add_delta_days: 30.06.2006 +1 Day = 01.07.2006?

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default add_delta_days: 30.06.2006 +1 Day = 01.07.2006?

    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

    thomas.reiss@gmx.de Guest

  2. Similar Questions and Discussions

    1. [Windows Uninstaller Updated 5/11/2006]
      We've made some revisions in the Flash Player uninstaller which should help eliminate some pain for IE Windows users having Flash Player issues. ...
    2. Parameter Type Conflict: sqlType=2006
      HiAll, migrating from CF5 to MX7 and using cfprocresult causes the following error: Parameter Type Conflict: sqlType=2006 VENDORERRORCODE ...
    3. Official: Vista release in November 2006
      This is the year… the year that Microsoft releases the newest version of Windows. Yes, Vista will be released in November of this year. So what is...
    4. starter pages for 2006 calendars
      Hi contribute 3.11 only has calendars for 2004 and 2005 under new page -> starter web pages -> basic pages -> calendars. Is there any way to get...
  3. #2

    Default Re: add_delta_days: 30.06.2006 +1 Day = 01.07.2006?

    [email]thomas.reiss@gmx.de[/email] 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
    Mark Clements Guest

  4. #3

    Default Re: add_delta_days: 30.06.2006 +1 Day = 01.07.2006?


    Mark Clements schrieb:
    > [email]thomas.reiss@gmx.de[/email] 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

    thomas.reiss@gmx.de Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139