-2
After following several instructions and operating guides of Date_format, I preferred to ask for help as I tried everything and could not format the date and time output of the Mysql database. Does anyone know why this function doesn’t work in this code? I need time at exit 29/02/2006 20:20. In my table my date line is of type datetime.
<?php
// aqui inicia a busca de comentarios dentro do banco de dados.
require 'conexao.php';
$buscaComentario = mysql_query("SELECT * FROM comentarios WHERE identificacao = '1' AND moderacao ='nao' ORDER BY data DESC ");
while ($lista = mysql_fetch_array($buscaComentario)) {
$nome = $lista['nome'];
$site = $lista['site'];
$comentario = $lista['comentario'];
$avatar = $lista['avatar'];
$data = $lista['data'];
DATE_FORMAT('data','%d/%c/%Y %H:%i:%s');
date_default_timezone_set('America/Sao_paulo');
echo "
<div id='comentario'>
<img src='uploads/$avatar' width='80'></img>
<p><strong> $nome</strong></p>
<p>$comentario $site </p>
<span><strong> $data</strong></span>
</div>
";
}
?>
<hr/>
<?php
You’re confusing things. The
date_format
ofmysql
is one thing, that ofphp
is another.– Wallace Maxters
thanks colleague, what should I use in this case then to get a date in the database the way I need?
– GOLX