I'm working on a page that will allow family/visitors to see information regarding my newphew. I was hoping to make a box that would say something along the lines of these statments:
"I am X years old."
"I will be X in XX days!"
X = Age in years.
XX = Days between current Age and next Birthday.
I've come up with this so far:
$birthdate ="1017810000"; // Birthday of Child
$current_time = time(); // Get current time
$diff_seconds = $current_time - $birthdate;
$years = floor($diff_seconds/31536000);
Echo"I am $years years old."; // Displays Age in Years
$next_year = $years+1; // Add one to display next age year
$days_left = " "; // Here is where I am stuck, how do I calculate the days till the next birthday?
Echo"I will be $next_year years old in $days_left days."; // Display next Age in Years in how many days.
So my problem is how do I make it calculate the days left till the next birthday? I tried a few variations of the script like I did for the Years, but I'm at a loss getting the last part. Can someone give me an idea on how to make this consistantly show the correct days left?