Ver Mensaje Individual
  #11 (permalink)  
Antiguo 08/10/2008, 09:50
adibu
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 7 meses
Puntos: 0
Respuesta: Problemas con la fecha

Estimados amigos.

No doy con la solución a mi problema, a pesar de las posibles soluciones que me habéis aportado (sobre todo jaronu) pero sigue sin funcionar.

He pensado en una solución, pero no sé si será posible.

El campo Fecha de mi tabla ahora es tipo: DATE, cambiarle al tipo: TIMESTAMP con valor predeterminado CURRENT_TIMESTAMP con lo que consigo que la tabla tome la fecha junto con la hora en la que se envió el formulario.

Sólo quiero que en la página que recupera los datos de la base de datos en el apartado de la fecha me recupere la fecha en formato: día-mes-año en ese orden.

Algo comentó sobre eso Jaronu, pero lo he probado y no funciona, igual es que lo coloco en un sitio distinto al que debe ir.

Si sabéis un código correcto para recuperar la fecha en formato español, os agadecería mucho que me lo comentéis y también el lugar dónde colocarlo, para ello os envío el código de la página que recupera los datos de la tabla:


<?php require_once('Connections/conexionconsultas.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_ver = 20;
$pageNum_ver = 0;
if (isset($_GET['pageNum_ver'])) {
$pageNum_ver = $_GET['pageNum_ver'];
}
$startRow_ver = $pageNum_ver * $maxRows_ver;

mysql_select_db($database_conexionconsultas, $conexionconsultas);
$query_ver = "SELECT * FROM `general`";
$query_limit_ver = sprintf("%s LIMIT %d, %d", $query_ver, $startRow_ver, $maxRows_ver);
$ver = mysql_query($query_limit_ver, $conexionconsultas) or die(mysql_error());
$row_ver = mysql_fetch_assoc($ver);

if (isset($_GET['totalRows_ver'])) {
$totalRows_ver = $_GET['totalRows_ver'];
} else {
$all_ver = mysql_query($query_ver);
$totalRows_ver = mysql_num_rows($all_ver);
}
$totalPages_ver = ceil($totalRows_ver/$maxRows_ver)-1;

$queryString_ver = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_ver") == false &&
stristr($param, "totalRows_ver") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_ver = "&" . htmlentities(implode("&", $newParams));
}
}

$queryString_ver = sprintf("&totalRows_ver=%d%s", $totalRows_ver, $queryString_ver);

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="760" align="center">
<tr>
<th width="120" scope="col">fecha</th>
<th width="333" scope="col">reforma</th>
<th width="181" scope="col">localidad</th>
<th width="106" scope="col">provincia</th>
</tr>
<?php do { ?>

<tr>

<td><div align="center"><?php echo $row_ver['Fecha']; ?></div></td>

<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['reforma']; ?></a></div></td>
<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['Localidad']; ?></a></div></td>
<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['Provincia']; ?></a></div></td>
</tr>
<?php } while ($row_ver = mysql_fetch_assoc($ver)); ?>
</table>
<br />
<table width="760">
<tr>
<td width="78"><?php if ($pageNum_ver > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_ver=%d%s", $currentPage, max(0, $pageNum_ver - 1), $queryString_ver); ?>" target="_blank">Anterior</a>
<?php } // Show if not first page ?> </td>
<td width="589">&nbsp;</td>
<td width="77"><?php if ($pageNum_ver < $totalPages_ver) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_ver=%d%s", $currentPage, min($totalPages_ver, $pageNum_ver + 1), $queryString_ver); ?>" target="_blank">Siguiente</a>
<?php } // Show if not last page ?> </td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($ver);
?>


Saludos cordiales.