How to count age?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anna

    How to count age?

    How can I count the difference between two dates? ( I can't change
    them into Unix format using mktime(), because in my database are also
    people born before 1970). Are there any alternative functions?
  • Pedro Graca

    #2
    Re: How to count age?

    Anna wrote:[color=blue]
    > How can I count the difference between two dates? ( I can't change
    > them into Unix format using mktime(), because in my database are also
    > people born before 1970). Are there any alternative functions?[/color]

    Maybe this helps?


    Never tried it, can't tell if it does.
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • Sharif Tanvir Karim

      #3
      Re: How to count age?

      "Anna" <annakk@go2.p l> wrote in message
      news:8b50f660.0 401110724.4d0bc 2b7@posting.goo gle.com...[color=blue]
      > How can I count the difference between two dates? ( I can't change
      > them into Unix format using mktime(), because in my database are also
      > people born before 1970). Are there any alternative functions?[/color]

      Why not just get the year from the date field and then to some simple math
      (substraction). ..

      --
      Sharif Tanvir Karim



      Comment

      • CountScubula

        #4
        Re: How to count age?

        "Anna" <annakk@go2.p l> wrote in message
        news:8b50f660.0 401110724.4d0bc 2b7@posting.goo gle.com...[color=blue]
        > How can I count the difference between two dates? ( I can't change
        > them into Unix format using mktime(), because in my database are also
        > people born before 1970). Are there any alternative functions?[/color]

        sure you can, here is an example:

        $t = time() - 10000000000;
        print date("F j, Y, g:i a",$t)."\n";

        this will print something around: 1959

        I also have a snippet that adjust from time servers 1900 based vs date()
        1970 based.


        --
        Mike Bradley
        http://www.gzentools.com -- free online php tools


        Comment

        Working...