Link to home
Start Free TrialLog in
Avatar of prashanth ag
prashanth ag

asked on

convert yyyy-mm-dd to mm/dd/yyyy in php

Before it was working fine this format getbusinessDays("2015-01-01","2015-12-31",$holidays)

function getbusinessDays($startDate,$endDate,$holidays)
{
$endDate = strtotime($endDate);                                  
$startDate = strtotime($startDate); before
}

i want convert  yyyy-mm-dd to mm/dd/yyyy

function getbusinessDays($startDate,$endDate,$holidays)
{
$endDate = date('mm/dd/yyyy', strtotime($endDate));                  
 $startDate = date('mm/dd/yyyy', strtotime($startDate));
}

but it shows error
Notice: A non well formed numeric value encountered             (i.,e both lines @$endDate & $startDate)
ASKER CERTIFIED SOLUTION
Avatar of Radek Baranowski
Radek Baranowski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
We have an article here that answers this question and many more about date / time values.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

Going forward, you might want to check the E-E articles, since many of the most common PHP questions are answered there with examples!