Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/05/2006, 04:53
silverrr111
 
Fecha de Ingreso: julio-2004
Mensajes: 45
Antigüedad: 22 años, 4 meses
Puntos: 0
Para formatear una fecha?

Hola a todos he estado viendo otros posts pero no llego a entenderlos muy bien (soy una novatazo en esto). El caso es que tengo un php que lee una base de datos y luego un flash que muestra el resultado.
Para grabar la fecha en formato correcto de flash a Mysql (aaaa-mm-dd) he hecho una chapucilla pero funciona, pero para pasar de php a flash no se hacerlo me lo lee igual (aaaa-mm-dd) y yo quiero que formatee la fecha así (dd-mm-aaaa).
Este es mi script aver si hay alguien que me eche una mano
Código PHP:
switch($action) {
      case 
'read' :
         
$sql = 'SELECT * FROM `' . $table . '`';
         
$allComments = mysql_query($sql, $DBConn) or die("Error: " . mysql_error());
         
$numallComments = mysql_num_rows($allComments);
         
$sql .= ' ORDER BY `fecha` DESC LIMIT ' . $_GET['NumLow'] . ', ' . $numComments;
         
$fewComments = mysql_query($sql, $DBConn) or die("Error: " . mysql_error());
         
$numfewComments = mysql_num_rows($fewComments);
         print 
'&totalEntries=' . $numallComments . '&';
         print 
"<br>&entries=";    
         
         if(
$numallComments == 0) {
            print 
"No hi ha cap concert previst...";
         } else { 
             
$i=0;
            while (
$array = mysql_fetch_array($fewComments)) {
               
$name = mysql_result($fewComments, $i, 'titulo');
               
$email = mysql_result($fewComments, $i, 'nom');
               
$comments = nl2br (mysql_result ($fewComments, $i, 'noticia'));
               
$fecha = mysql_result($fewComments, $i, 'fecha');
               

     
               print 
'<b>' . $name . '</b>  <br>' . $fecha . '<br><h5>' . $email . '</h5>  <br><br>' . $comments . '<br><br><br>';
               
$i++;
            }
        }
        if(
$_GET['NumLow'] > $numallComments) {
           print 
'No hi han més entrades!&';
        }
        break;