Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

date problem

Avatar of syedasimmeesaq
syedasimmeesaqFlag for United States of America asked on
3 Comments1 Solution233 ViewsLast Modified:
I am using this to count the days till it expires

function dateDiff($dformat, $endDate, $beginDate)
$date_parts1=explode($dformat, $beginDate);
$date_parts2=explode($dformat, $endDate);
$start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
$end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
return $end_date - $start_date;

$expiry_date = "07-11-2106";
$today = date('m-d-Y');

echo dateDiff("-",$expiry_date,$today); // # of days
echo "<br />";

which works fine. But if I change the $expiry_date = "2106-07-11" and $today = date('Y-m-d') it stops working. I need it to be in Y-m-d formate ..what can I do. Thanks
Avatar of Mahdii7
Mahdii7Flag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers