Michael W.: Alter einer Person berechnen

Beitrag lesen

hallo,
Ich habe das mal ausprobiert, aber warum verechnet sich meine lösung um ein Jahr

http://mitglied.lycos.de/djwoelk3/djwoelk/geb1.php

hier der code:
geb1.php:

<html>
<body>
  <form method="POST" action="geb2.php">
<div align="left">
          <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="760">
            <tr>
              <td width="72"></td>
              <td width="139"><font size="2">Dein Geburtsdatum</font></td>
              <td width="549">
              <input type="text" name="jahr" size="4" value="Jahr">-<select size="1" name="monat">
              <option>01</option>
              <option>02</option>
              <option>03</option>
              <option>04</option>
              <option>05</option>
              <option>06</option>
              <option>07</option>
              <option>08</option>
              <option>09</option>
              <option>10</option>
              <option>11</option>
              <option>12</option>
              </select>-<select size="1" name="tag">
              <option>01</option>
              <option>02</option>
              <option>03</option>
              <option>04</option>
              <option>05</option>
              <option>06</option>
              <option>07</option>
              <option>08</option>
              <option>09</option>
              <option>10</option>
              <option>11</option>
              <option>12</option>
              <option>13</option>
              <option>14</option>
              <option>15</option>
              <option>16</option>
              <option>17</option>
              <option>18</option>
              <option>19</option>
              <option>20</option>
              <option>21</option>
              <option>22</option>
              <option>23</option>
              <option>24</option>
              <option>25</option>
              <option>26</option>
              <option>27</option>
              <option>28</option>
              <option>29</option>
              <option>30</option>
              <option>31</option>
              </select></td>
            </tr>
            <tr>
              <td width="72"></td>
            </tr>
            <tr>
              <td width="72"> </td>
              <td width="139"> </td>
              <td width="549"><input type="submit" value="Alter Berechnen"></td>
            </tr>
          </table>
        </div>
      </form>
</html>
</body>

---------

geb2.php:

<?php

$gebTag=$jahr.$monat.$tag;
$heute='2002-07-28';

$gebdate=mktime(0,0,0,intval(substr($gebTag,5,2)),intval(substr($gebTag,8,2)),intval(substr($gebTag,0,4)));
$aktdate=mktime(0,0,0,intval(substr($heute,5,2)),intval(substr($heute,8,2)),intval(substr($heute,0,4)));
$diff=getdate($aktdate-$gebdate);
$alter=$diff[year]-1970;

print "Alter: ".$alter;

?>

-------

Danke