Burdie87 Burdie87 - 6 months ago 10
PHP Question

Mysql Multiple use of Date_Format

I am currently using

$resultc = mysql_query( "SELECT *, DATE_FORMAT(Tender_Return_Date,'%d/%m/%Y') AS Tender_Return_Date FROM Est_Ind_Client
LEFT JOIN Est_Ind_Client_Notes ON Est_Ind_Client.C_ID=Est_Ind_Client_Notes.Ind_C_FK
WHERE Ind_FK='{$row["EI_ID"]}'" );


As part of the above statement, I have two further date fields being "Date_Received" and "Company_Return_Date" which I also wish to format in the same way as above. I have tried repeating the format statement but receive errors from the MYSQL query. I have looked online for a solution but the only examples include for formatting one date as above and I require multiple occurances

Any guidance would be great.

Answer

If I understood you right, you need this:

SELECT *, 
    DATE_FORMAT(Tender_Return_Date,'%d/%m/%Y') AS Tender_Return_Date, 
    DATE_FORMAT(Date_Received,'%d/%m/%Y') AS Date_Received,
    DATE_FORMAT(Company_Return_Date,'%d/%m/%Y') AS Company_Return_Date
 FROM Est_Ind_Client 
 LEFT JOIN Est_Ind_Client_Notes ON Est_Ind_Client.C_ID=Est_Ind_Client_Notes.Ind_C_FK 
 WHERE Ind_FK='{$row["EI_ID"]}'"
Comments