Calculate age from birthdate
I have a family birthday calendar on my website. I have the day, month, and year each family was born and would like to calculate and print the age of every on the day the site is visited. If this is possible would someone please help me do this or point me in the right direction? Thanks
It is possible, just not with direct and sole use of iWeb application. You need to choose a dynamic scripting language, setup a database table for the users birthdate, then use dynamic scripting to determine the age of each user based off their birthdate.
Similar Messages
-
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
ManuManu 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. -
Calculate age from a date on numbers
I am trying to calculate age from a given date in the application numbers. The dates are all in the same column but i need to convert them to ages. I have not been able to find any formulas!
ThanksHi,
DATEDIF is a good place to start:
This example is from the Function help in Numbers, I claim no credit for it. -
Calculate age from a specified time
I need to calculate the age based upon the time specified.
E.g.
Suppose time specified is:
3605000 millisecinds
It should return an age of : 1 Hour 5 seconds.
Was wondering if anyone can help me here.
Thanks,
SAMUse the date object to convert it to hours, seconds and milliseconds.
For eg:
if 3605000 is the milliseconds,
var date:Date = new Date(null,0,0,0,0,0,3605000);
Alert.show(date.getHours() + ":" + date.getMinutes()+ ":" + date.getSeconds()+":"+date.getMilliseconds());
the above code will give you the number of hours, minutes, seconds and milliseconds.
Regards,
Anitha -
Calculate age from date of birth
hi all,
I have date of birth of few employees,
I want to know how can i find out their age,
Please guide,
thanks,
HMhi
DATA : BIRTH_DATE LIKE SY-DATUM,
DAYS TYPE NUM2,
MONTHS TYPE NUM2,
YEARS TYPE NUM2.
BIRTH_DATE = '19830307'.
CALL FUNCTION 'HRCM_TIME_PERIOD_CALCULATE'
EXPORTING
BEGDA = BIRTH_DATE
ENDDA = SY-DATUM
IMPORTING
NOYRS = YEARS
NOMNS = MONTHS
NODYS = DAYS
EXCEPTIONS
INVALID_DATES = 1
OVERFLOW = 2
OTHERS = 3.
WRITE : / YEARS , 'years' , MONTHS , 'months' , DAYS , 'days'.
regards
ravish
<b>plz dont forget to reward points if helpful</b> -
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
ManuYou already asked this question:
How to calculate AGE from two different date fields -
Is there a way to calculate age from DOB in the RPD business model layer? In the table, there is only DOB stored in string format (e.g. 19700125, YYYYMMDD format) and we need to dervie age in the RPD.
Here's a hint:
use TimestampDiff funtction
such as TimestampDiff (SQL_TSI_YEAR, date1, now() )
You might have to use CAST function to turn your column into date type....
I hope this is helpful. -
How to calculate Age in BEx query
Hi,
I need to calculate age in years based on person's date of birth and the key date that user of the report will enter.
So, basically in my query I already have date of birth characteristic from 0PERSON InfoObject. I created ZAGE key figure and added it to the query that I would like to populate with person's age.
So I know I have to enter some code in CMOD for calculated key figure ZAGE to get calculated based on birthdate and key date that user enters. Can somebody help with the code?
thanksHi,
The variable should be in "Date" dimension. I have missed one important information in earlier mail.
The processing type of the variable (user entry date) should be of "Customer Exit' and dimension (in last tab) should be "Date".
By selecting this dimension, the variable input help screen also appears in calendar format to help user to select date instead of writing it in variable input.
No need to write any custom code for this variable. We are selecting the "Customer exit" processing type to get Date dimension. In Normal user entry variables we can't get date & time dimension.
"Ready for Input" should be selected so that user can enter date.
I hope you can solve your issue now.
Thanks for your feedback.
Regards,
Arun Thangaraj.
Edited by: Arun Thangaraj on Oct 8, 2008 8:48 AM -
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 in SQL?
I have a table with DATE as one of the column.
How do I calculate age?
Thanks in advance
-Shilpamichaels2 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. -
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,
PCsorry..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 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> -
Calculate Age in an ABAP report
Hi all you wonderful SAP people,
I am trying to calculate age in my ABAP report,
Any function module I can use or code snippet? Your help is much appreciated. Points will be awarded.
Regards
RamoruaHi Mohamed, some characters (plus signs, and spaces around the minus) seem to have gotten lost from your code, maybe during the conversion of the forum. Also, the data type is i, not int.
Header 1
DATA: lv_age TYPE i.
lv_age = sy-datum(4) - lv_birthdate(4).
IF sy-datum+4(4) LT lv_birthdate+4(4).
lv_age = lv_age - 1. " or SUBTRACT 1 FROM lv_age.
ENDIF. -
To get actual age from sysdate
sir,
i did what syntax u have provided but failed to get the value.
please check my query where had done wrong.
SQL>select trunc((to_char(&sysdate, 'mm/dd/yyyy')-to_char(&birthday, 'mm/dd/yyyy'))/10000)as age
from dual;
Enter value for sysdate: '10/14/2006'
Enter value for birthday: '02/08/1980'
select trunc((to_char('10/14/2006', 'mm/dd/yyyy')-to_char('02/08/1980', 'mm/dd/yyyy'))/10000)as age
ERROR at line 1:
ORA-01722: invalid numberbut LAURENT SCHNEIDER is one of oracle certified master, who posted it.
does this syntax wrong????
please revert my question back.
How old are you?
I just come back from holiday, I am quite busy at the moment. Here is a tiny function to get the age
trunc((to_char(sysdate,'YYYYMMDD')-to_char(birthdate,'YYYYMMDD'))/10000)
it is much safer than add_months, because add_months do some conversion at the end of the month, and I would never accept to wait until Feb 29th, 2008 (28-2-1990 + 18*12 months) to be 18 if I were born Feb 28th, 1990.
POSTED BY LAURENT SCHNEIDER AT 5:43 PM
1 COMMENTS:
Anonymous said...
oh greate!!
def birthdate = to_date('2000/02/29','yyyy/mm/dd')
def sys_date = to_date('2003/02/28','yyyy/mm/dd')
select
trunc((to_char(&sys_date,'YYYYMMDD')-to_char(&birthdate,'YYYYMMDD'))/10000) as age from dual;
def sys_date = to_date('2003/03/01','yyyy/mm/dd')
select
trunc((to_char(&sys_date,'YYYYMMDD')-to_char(&birthdate,'YYYYMMDD'))/10000) as age from dual;
thanxx in advance -
Hi
Please suggest me to wirte a function which can calculate age.Hi,
No need of function. Just simple calculation.
SQL> select round(months_between(sysdate,to_date('11-MAY-1977','dd-MON-YY'))/12) age from dual;
AGE
33If you are taking in account the dates stored in a date column of oracle table then do take care of the years
before and after 1950.
A thread for your reference: Re: date airthmetic
Maybe you are looking for
-
Addition of field in std reprt S_ALR_87012103
HI, In std report S_ALR_87012103 (List of vendor line items), we wan't to add one field as ' hard currency'. Plz suggest . Regards,
-
I had my hard drive cleaned and cannot install cs6 master collection from disk. I am getting error message failed to initialize. please download adobe advisor support. I am using a pc and have windows 8. Please help.
-
How to create tcode in SAP tree?
HEllo All, I need to create a tcode in SAP tree.(Initial login screen).Theres a customer specific folder in information systems folder.I need to create a tcode here.Please let me know how to do that. Thanks, Rakesh.
-
Image stacking (z-index) flex 3.5
Hi This is probably a really simple question, well I hope so, but I cant figure out how to have an image over top of another. The senario is Im making a banner. I want the left image to be layered over top of the right image. Thanks for any advice.
-
Transfer itunes info from WIN to MAC
hi everyone, i just bought a new macbook last week, but I am wondering how do I transfer my old itunes information like my applicaions and playlist to my newly installed itunes in my macbook. Pls help.