PHP years since date script
Go to solution
Solved by leodaniel,
1 hour ago, Joveice said:Hi, I tryed to look for a script that will display years since a date but I couldent find it. is there anywhere I can learn this fast or if someone can point me towards a snippet?
Try this
$now= new DateTime();
// Insert your Date here!
$date= new DateTime("22.08.2014");
// Get Difference as DateInterval
$difference = $now->diff($date);
// Get The Difference in Years
echo $difference->format("%y");

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now