I'm running a MSSQL function and returning to PHP and I'm using the function twice in the PHP and writing it away to a MySQL database.
The first time I run the function I'm using $to and $from (I'm well aware it's not pretty, I'm not a php coder by trade...)
$to = date("j M Y", mktime());
$year = date("Y", mktime());
$jan = '1 jan ';
$from = $jan . $year;
I'm then using the following
select * from MISYearToDate('$from', '$to')
and that works absolutely fine.
When I then do the same thing but putting in this week's dates using
$weekstarting = date('j M Y', strtotime('last sunday'))."<br>";
$weekending = date('j M Y', strtotime('next saturday'))."<br>";
and then run
select * from MISYearToDate('$weekstarting', '$weekending')
I'm getting the error
[Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting date and/or time from character string. )
$From and $to echo
1 jan 2012
27 Jun 2012
$weekstarting and $weekending echo
24 Jun 2012
30 Jun 2012
So as far as I can tell, there really isn't a difference and I'm pretty damn confused!