How do I show number of days between 2 dates

This script is for backorders on my online store.

Today's Date minus Order Date = number of days

$date=date("m/d/y") - $orderdate
03/12/15 - 02/12/15 = 30

I have tried several different things and cannot get number of days returned.
Who is Participating?
Phil PhillipsDirector of DevOps & Quality AssuranceCommented:
Something like:

$date1 = new DateTime();
$date2 = new DateTime($orderdate);

$diff = $date2->diff($date1)->format("%a");
echo $diff;

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.