Ciao a tutti, chiedo aiuto. Vorrei formattare la data di inserimento di un form da YYYY-MM-DD a DD/MM/YYYY per la selezione dati di un database da una certa data ad un'altra.
Finchè uso l'inserimento YYYY-MM-DD funziona tutto correttamente ma non riesco con DD/MM/YYYY.
Mi potete aiutare?
Grazie mille
<?php
mysql_connect("localhost", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
$data1=$_POST['da']; // sistema il name dell'input form mettendo l'underscore
$data2=$_POST['a']; // underscore anche per questo
//query
$result=mysql_query("select date_format(date,'%d/%m/%Y')as giorno,MONTH(date) AS mese,avg(temp),avg(umidita),avg(20-(temp)) as gradigiorno from TABELLA2
WHERE date BETWEEN '$data1' AND '$data2' group by giorno order by date desc limit 1000");
// prepara intestazione tabella //
echo "<table style='text-align:center'><tr ><th width='100px'>Giorno</th><th width='100px'>Temperatura</th><th width='100px'>Umidità</th><th
width='100px'>Gradigiorno</th></tr>";
while($row = mysql_fetch_assoc($result))
{
// crea riga tabella//
echo "<tr><td >".($row['giorno'])."</td><td>".number_format(($row['avg(temp)']),2)."</td><td>".number_format(($row['avg
(umidita)']),2)."</td><td>".number_format(($row['gradigiorno']),2)."</td></tr>";
}
// chiude tabella //
echo "</table>";
?>