I need the string form of a date minus 6 days. This is driving me crazy
Code:
$a_Date_String = '20140809';
//this works fine
$Week_Ending = date ("Y-m-d", strtotime($a_Date_String));
$Week_Begin = new DateTime($a_Date_String);
$Week_Begin->sub(new DateInterval('P6D'));
/*
I now have a string for $Week_Ending "2014-08-09",
but the $Week_Begin is a date object
[B]How do I extract "2014-08-03" from the $Week_Begin[/B]?
I want to use the string value in my query on the MySQL table like this.
*/
$sql = 'select '.$cSelect.' from '.$cFrom.' where workDay between " '.[B]$Week_Begin[/B].'" and "'.[B]$Week_Ending[/B].'" ' order by '.$cOrderBy;
Comment