Calculation

View: New views
2 Messages — Rating Filter:   Alert me  

Calculation

by Ummy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I need to know how to calculate an age by using the date of birth and the current date. I would like the current date to be linked to the computer clock so as a birthdate passes the age changes.

Re: Calculation

by silent_swordsman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

<day of current - day of birth>, <month of current - month of birth>, <year of current - year of birth>

if the day of current not enough to substract the day of birth, you may plus 30 to it and remember to substract 1 from the month. and if the month of current does not enough to substract the month of birth, you can add 12 for substracting 1 from year of current.

e.g. a boy's birth : 2-12-1992    current date : 1-11-1998

     1         11         1998
  -  2         12         1992

=   31       22         1997
  -   2        12         1992

=   29       10               5

we can said that the boy was 29 days 10 month and 5 years old.