PHP: How to get a Date when a person reach to a specific age? -
i working on task in dates involved. have person's age in months+days. want date when person reach specific age in months.
for example:
a person 250 months , 15 days old on 2010-1-25. on date person become 300 months old?
function signature may be:
function getreqdate( $startdate, $curragemonths, $curragedays, $reqagemonths ) { //return date }
since calculate current age birthdate, suggest use birthdate instead of current age calculate when user gets 300 months old. following equivalent of datetime solution given above (does not require 5.3):
echo date('r', strtotime('+300 months', strtotime('1990-10-13')));
with second param being birthdate timestamp above give
tue, 13 oct 2015 00:00:00 +0200
further reading:
Comments
Post a Comment