adilamarwat Posted April 4, 2009 Share Posted April 4, 2009 Sir, My date of Birth is 03-Sept-1987 and i want to compare it with current date i.e 30-March-2009. and output should be the my current age. like 22 Yeas 08 Months 25 Days plz help in my problem. Link to comment Share on other sites More sharing options...
Ingolme Posted April 4, 2009 Share Posted April 4, 2009 Use mktime() to create a timestamp for the dates you want to compare. Subtract the smaller timestamp from the greater one. Usedate() to obtain the values for years, days, and months of the resulting timestamp. Put these values into a string and display it on the page. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 6, 2009 Share Posted April 6, 2009 There's also a class to help with that:http://www.php.net/manual/en/datetime.diff.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.