Does you mean calender?
This is a discussion on hw to calculate the age in PHP? within the Web Design forums, part of the Web Designing & Development category; Hi friends. can anybody tell me the code for calculate the perfect age in PHP. I m looking for a ...
Hi friends.
can anybody tell me the code for calculate the perfect age in PHP. I m looking for a code that can show the perfect age date, time , month.
thanks
Does you mean calender?
No buddy.
My mean is if anybody register on my site, my site show the exact date of birth of user with his profile.
hope you understand
thanks
Ok my dear
here is a php script for displaying actual date of birth of user.
Code:<div class="fields"> [COLOR=#000000][COLOR=#0000BB]<?php $year_diff [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]date[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"Y"[/COLOR][COLOR=#007700]) - ([/COLOR][COLOR=#0000BB]$user[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]profile_dob[/COLOR][COLOR=#007700]{[/COLOR][COLOR=#0000BB]year[/COLOR][COLOR=#007700]}); [/COLOR][COLOR=#0000BB]$month_diff [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]date[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"m"[/COLOR][COLOR=#007700]) - ([/COLOR][COLOR=#0000BB]$user[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]profile_dob[/COLOR][COLOR=#007700]{[/COLOR][COLOR=#0000BB]month[/COLOR][COLOR=#007700]}); [/COLOR][COLOR=#0000BB]$day_diff [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]date[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"d"[/COLOR][COLOR=#007700]) - ([/COLOR][COLOR=#0000BB]$user[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]profile_dob[/COLOR][COLOR=#007700]{[/COLOR][COLOR=#0000BB]day[/COLOR][COLOR=#007700]}); if ([/COLOR][COLOR=#0000BB]$month_diff [/COLOR][COLOR=#007700]< [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]) [/COLOR][COLOR=#0000BB]$year_diff[/COLOR][COLOR=#007700]--; elseif ([/COLOR][COLOR=#0000BB]$month_diff [/COLOR][COLOR=#007700]== [/COLOR][COLOR=#0000BB]0 [/COLOR][COLOR=#007700]&& [/COLOR][COLOR=#0000BB]$day_diff [/COLOR][COLOR=#007700]< [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]) [/COLOR][COLOR=#0000BB]$year_diff[/COLOR][COLOR=#007700]--; [/COLOR][COLOR=#0000BB]?>[/COLOR][/COLOR] <p>AGE: [COLOR=#000000][COLOR=#0000BB]<?php [/COLOR][COLOR=#007700]print [/COLOR][COLOR=#0000BB]$year_diff[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000BB]?>[/COLOR][/COLOR] </p> </div>
Thanks for the reply.
But i found it.
i m not implement this. but i think it works.$age = floor((time() - strtotime($birthdate))/(60*60*24*365.2425));
thanks
That code is not sufficient. may be it will work....i am not sure but you have another code also what i suggest you before.
Bookmarks