Jump to content

Age Code


WAMFT1

Recommended Posts

Hi all

 

I was using the below code on our website to return current age and it works perfectly. Recently we had to change our web host and now this piece of code seems to be a casualty to the move. The page stops loading past this point.

 

Can anyone suggest why or what I can use in its place? I liked that it was just one line. Easy.

<?php $now=new DateTime(); $birthday=new DateTime($dob); $interval= $now->diff($birthday); echo $interval->format('%Y');?>
Link to comment
Share on other sites

Thanks Barand, I have managed to get the original code working again. I checked the table structure after the move and nothing had changed there but I noticed that dates and time were not correct. I added a set timezone to the functions file and now everything seems to be working again.

 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.