Date Format change in query
Hi All,
I am facing a issue in changing the date format of a column in my database. Below is my code
PHP Code:
$fromdate = $_REQUEST['fromdate']; // this date is in format 22-06-2012
$todate = $_REQUEST['todate']; // this date is in format 22-09-2012
$query = mysql_query("select * from customer where joined_date >= '$fromdate' and joined_date <= '$todate'");
// the above query is giving me null value because i stored the date as 22/08/2012(joined_date). The date format is different. I want to happen this in query only.
Below is something i am trying to change format in query, but not working
PHP Code:
SELECT date_format(joined_date,'%d-%m-%Y') as date,joined_date FROM customer where code = '3016'
The above query is giving null value, how to solve the issue?