How do I calculate age?

Hi again!
I would like to calculate a registered users age using the
date of birth inputted by the user. I want to display this age on
the profile page of the user.
Does anyone know of an easy way to do this?

If dateOfBirth is the variable with their date of birth in
then as follows:-
<cfset age = dateDiff("yyyy", dateOfBirth,
now())>

Similar Messages

  • How do I calculate age (in numbers)

    ... just switched to Numbers, used to Excel...
    I suspect it's got to do with Data Formats...
    Please help!

    I would direct you to existing thread on the subject.
    https://discussions.apple.com/thread/1380192

  • How to calculate age in SQL?

    I have a table with DATE as one of the column.
    How do I calculate age?
    Thanks in advance
    -Shilpa

    michaels2 wrote:
    TryWell it still leaves leap year question open. If person was born on February 29, how old is that person on February 28 of a non-leap year? Your code considers it imcomplete year:
    SQL> var dob varchar2(20)
    SQL> exec :dob := '19960229';
    PL/SQL procedure successfully completed.
    SQL> select trunc ( (to_number (to_char (to_date('20090228','yyyymmdd'), 'yyyymmdd'))
      2                  - to_number (to_char(to_date(:dob, 'yyyymmdd'),'yyyymmdd'))
      3                  )
      4                / 10000)
      5            as "Age of Child"
      6    from dual
      7  /
    Age of Child
              12SY.

  • Calculate age in oracle 11g

    how do i calculate age based on date picker in another field on the same table/

    Are you sure of that algorithm?
    orclz> SELECT Round((SYSDATE-to_date('01-JAN-1989','dd-MON-yyyy'))/365) FROM DUAL;
    ROUND((SYSDATE-TO_DATE('01-JAN-1989','DD-MON-YYYY'))/365)
                                                           25
    orclz> SELECT Round((SYSDATE-to_date('01-DEC-1989','dd-MON-yyyy'))/365) FROM DUAL;
    ROUND((SYSDATE-TO_DATE('01-DEC-1989','DD-MON-YYYY'))/365)
                                                           24
    How about this:
    orclz> select extract (year from sysdate) - extract( year from to_date('01-DEC-1989','dd-MON-yyyy')) from dual;
    EXTRACT(YEARFROMSYSDATE)-EXTRACT(YEARFROMTO_DATE('01-DEC-1989','DD-MON-YYYY'))
                                                                                24
    orclz> select extract (year from sysdate) - extract( year from to_date('01-JAN-1989','dd-MON-yyyy')) from dual;
    EXTRACT(YEARFROMSYSDATE)-EXTRACT(YEARFROMTO_DATE('01-JAN-1989','DD-MON-YYYY'))
                                                                                24
    orclz>

  • ABAP-HR MODULE(HOW TO CALCULATE AGE & YEARS OF SERVICE)

    HI,
    HOW TO CALCULATE AGE & YEARS OF SERVICE means for example
    I AM USING PNPCE LDB.
    (1) whose age is greater than 52.833 years with 7.833 years of service, with annual rate of pay $170,000 or more, or
    (2) age plus employment service is 65 or more, with annual rate of pay of $ 170,000 or more.
    Note that the $ 170,000 parameter would be a variable that could change annually when this report would be generated. In the past, age and service value were determined as of the run date. The determination date would also be a variable that would change when the report would be generated.
    Thanks&Regards
    Rahul.

    Hi Rahul,
    This is the 2nd warning !!! Please... use the correct or most appropriate forum.
    The ABAP Objects Forum should be used for: ABAP Object definition and implementation including encapsulation, interfaces and inheritance in ABAP Objects.
    This thread will be moved from to .
    You're asking this question in two thread, so the duplicated thread will be deleted.
    Please have a look at [Forum Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] before posting.
    Also read this thread Welcome and Rules of Engagement.
    Greetings,
    Marcelo Ramos

  • How to Calculate %age value

    Hi All,
    i have a query
    I have data like below
    cy
    data
    CY 2008
    4290421
    CY 2009
    4069379
    CY 2010
    3979492
    CY 2011
    3940169
    and i want output like this
    cy
    data
    CY 2008
    4290421
    % change
    -5%
    CY 2009
    4069379
    % change
    -2%
    CY 2010
    3979492
    % change
    -1%
    CY 2011
    3940169
    for percent change the formula is in excel for %age change of CY 2008 to CY 2009 = (CY 2009 / CY 2008 -1 )*100
    how we can calculate in SAP BO INFOVIEW 3.1 and it will run automatically in future also for 2012,2013 so on
    Please Advice..
    Thanks in advance.
    Ranjeet

    Hi Riaz,
    Sorry for delay response
    Please find the attachment
    variable (formula) =([data]/Previous([data])-1)*100
    the final result
    if you want more information let me know
    Thanks
    Ranjeet

  • How to calculate age for a business partner for segmentation purposes?

    How do I calculate the age of a BP based on this person's maintained birthday on BP master data?  I need to use this information to segment based on age groups, eg age 30-40, age 25 and below etc.
    I did quite a bit of search on this forum but couldn't find anything.  I know I've seen them somewhere before.  Would appreciate any help and will reward points.  Thanks!

    Hi Jo,
    You can achieve this by using infosets.
    Create Infoset using direct read of table BUT000.
    In infoset select extras for additional field button and give following code for calcualting the difference between Birthdate and system date.
    CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
        EXPORTING
          i_date_from          = but000-BIRTHDT
          I_KEY_DAY_FROM       =
          i_date_to            = sy-datum
            I_KEY_DAY_TO         =
            I_FLG_SEPARATE       = ' '
       IMPORTING
         e_days               = test
            E_MONTHS             =
            E_YEARS              =
    Create a datasource with Business partner GUID and assign it attributelist.
    Choose the additional field for filter criteria.
    Hope it solves your problem.
    Reward points if it helps.
    Regards,
    Madhu

  • How to calculate Age(more details)

    Hi
    I want to calculate the age but not only depending on substracting the years, i have to take into consederation the day and month and year
    for example
    taking into consederation that the date today is 08/08/1999
    someone born on 1/1/1970
    he is 29
    someone born on 18/09/1963
    he is 35
    someone born on 12/12/1976
    he is 22
    how can we calculate the date to get these results
    Thanks

    You can use StringTokenizer to parse out the months, days and years. Once you do that it's easy to compare them to get the age.
    String today = "08/08/1999"
    String bDay = "07/10/1977"
    StringTokenizer st = new StringTokenizer(today,  "/");
    String todayMonth = st.nextToken();
    String todayDay = st.nextToken();
    String todayYear = st.nextToken();Then just do the same thing with bDay and you can compare everything to figure out the age.

  • How to Calculate AGE by getting difference between two Date Fields

    HI Gems
    I need to calculate AGE from getting difference from two date fields. But when i am trying to wrte fromula as Current date - date1(some date field) then it is showing error.
    How can i get values.
    Thanks
    Manu

    You already asked this question:
    How to calculate AGE from two different date fields

  • How to calculate AGE from two different date fields

    hi
    I need to calculate AGE from two different date fields.
    Can some help me how to do, when i try to do substraction formula it is showing error.
    Thank You
    Manu

    Manu wrote:
    Hi
    Both fields are in date format only, i need to calculate no . of days between two different dates
    Thanks
    ManuThe reason for the question about the format of the column is because the simplest solution only works on DATE columns. Others have mentioned this here, but if you want the difference between two date fields, you can use this formula:
    TIMESTAMPDIFF(SQL_TSI_DAY, date_column1, date_column2)
    The above being said, you still didn't tell me what you did, or what error message you received. So again, if the above formula didn't work, what did you do? Where did you put the formula? What was the exact syntax you used? What was the error message you got?
    Please don't make us work more than we need to. Answer all the questions in your next post. Thanks.

  • How to calculate age based on current month and over the next 12 months in Webi 4.1

    Hi,
    I am working on a report where I need to show employees who turned 65 from the time the report is run to over the next 12 months.I have the 'Date of Birth' field available. I am using Bex Query as a data source and webi 4.1. How do I calculate this in Webi 4.1. I appreciate any help.
    Thank you,
    Charvi.

    Hi Charvi,
    Get the all employees who are all in 64 age bucket till yesterday.  Keep indicator for these employees.
    Then obviously these employees will be falling in 65 age in coming 12 months/365 days.
    Same you can get at Bex level also. Create formulae :
    if employee age = 64 then 1 else 0.
    (AGE = 64 * 1 + 0)
    Then create condition on this formulae as Value = 1.
    Revert back your feedback.
    Regards, Vijay

  • How to calculate age in oracle

    Hi,
    T was trying do calculate age as on todays date in ORACLE but after a lot of brain storming i didn't get it.
    Kindly tell me how to calculate age as in years month days.
    For ex.. My DOB- 02-feb-1984 so my age should get as 27 Years 2 months 8 days
    How to do it.
    I tried this
    select
    TRUNC( months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') )/12 ) Year,
    TRUNC( mod(months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') ),12) ) Month,
    mod(months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') ),12) /30 Days
    from dual
    but days are not calculating correctly...
    RGds,
    PC

    sorry..i didn't chck your query..it is right but give wrong answer..
    WITH got_months AS
         SELECT     TO_DATE('02-02-1984','DD-MM-YYYY')
         ,     FLOOR (MONTHS_BETWEEN (SYSDATE, TO_DATE('02-02-1984','DD-MM-YYYY')))     AS months
         FROM     dual
    SELECT     TO_DATE('02-02-1984','DD-MM-YYYY')
    ,     TO_CHAR (FLOOR (months / 12))     || ' years, '     ||
         TO_CHAR (MOD (months, 12))      || ' months, '     ||
         TO_CHAR ( CEIL ( SYSDATE
              - ADD_MONTHS ( TO_DATE('02-02-1984','DD-MM-YYYY')
                        , months
              )               || ' days'
    FROM got_months
    o/p
         TO_DATE('02-02-1984','DD-MM-YY     TO_CHAR(FLOOR(MONTHS/12))||'YE
    1     2/2/1984     27 years, 7 months, 9 days
    1 day more..1     it sud be.. 2/2/1984     27 years, 7 months, 8 days
    if i make correction with add_months like below..
    WITH got_months AS
         SELECT     TO_DATE('02-02-1984','DD-MM-YYYY')
         ,     FLOOR (MONTHS_BETWEEN (SYSDATE, TO_DATE('02-02-1984','DD-MM-YYYY')))     AS months
         FROM     dual
    SELECT     TO_DATE('02-02-1984','DD-MM-YYYY')
    ,     TO_CHAR (FLOOR (months / 12))     || ' years, '     ||
         TO_CHAR (MOD (months, 12))      || ' months, '     ||
         TO_CHAR ( CEIL ( SYSDATE
              - ADD_MONTHS ( TO_DATE('02-02-1984','DD-MM-YYYY')
                        , months
                        )-1
              )               || ' days'
    FROM got_months
    then o/p is..
         TO_DATE('02-02-1984','DD-MM-YY     TO_CHAR(FLOOR(MONTHS/12))||'YE
    1     2/2/1984     27 years, 7 months, 8 days
    correct but cdnt understand why sud -1?

  • How do i calculate e age given e year of birth?

    how do i calculate e age given e year of birth?

    RubberFaceDuckie, two things:
    1) please don't crosspost all over the forums.
    2) I don't think that it would help much if we tell you the code for such a simple operation; if you have trouble doing this, either go and tell your teacher (maybe the better idea), or try to figure it out alone. This problem shouldn't be unsolvable for you, and it seems to me that you need more practice and to spent more thoughts on your solution. Before you write a program, you should be sure about the program's algorithm.

  • How do i calculate the age given the dob?

    How do i calculate the age given the dob?

    Date dateOfBirth = yourObject.getDateOfBirth();
    float ageInMillis = System.currentTimeMillis() - dateOfBirth.getTime();

  • How do I calculate the age given the year of birth?

    How do I calculate the age given the year of birth?

    Get the current year using the getYear() method. Subtract the year of birth from the current year. The age is calculated.
    d.

Maybe you are looking for

  • How do you transfer music from one i pod to another

    I am going to be getting a new i pod touch and i want all the music and playlists from my old i pod to go onto my new one and im wondering how to do that?

  • Safari incompatibility with MS Office for MAC

    Ever since downloading and installing Safari Version 4 two days ago, I am unable to open MS Office for Mac. Entourage, Powerpoint, Word, and Excel are all affected. Any suggestions?

  • Artwork in Finder not visible

    All of a sudden, I can't see the artwork of audio files in Finder any more. I am pretty certain that I was able to see the artwork (cover art) a few days ago. This happens with mp3's, m4b's, and m4a's. All of the files reside on a external USB disk.

  • How I connect my Ipod touch to wi-fi

    just got my ipod and I don't know how to connect it and if it suppose to be connecting by itself? Help me please.

  • EVDRE sheet expansion problem

    i created an evdre with sheet expansion to expand across tabs and when i expand all, the same data is displayed on every sheet even though each tab has a different name. has anyone else ever encountered this?