Mi consulta es la siguiente:
Tengo un formulario llamado lote, su Insert Into y su Extraer. En el formulario hay un campo en el que se introduce la fecha mediante un calendario. Necesito que cuando se realize la consulta, aparesca en un campo llamado edad actual, el tiempo en semanas a partir de la fecha que se introdujo en el formulario.
tengo un codigo muy corto que muestra el tiempo en semanas, pero lo malo es que muestra las semanas desde el primer dia del año en curso, y yo necesito que me muestre el tiempo en semanas, a partir de una fecha que se de como inicial.
El otro problema es que al correr este codigo aparce el siguiente mensaje:
Strict Standards: DateTime::__construct() [datetime.--construct]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST'
El punto àlgido del asunto es como introduzco este còdigo en el extraer para que se manifieste al realizar la consulta.
Les adjunto el script del formulario, su Insert, el extraer y el de mostrar las semanas.
Por fabor le ruego leer el codigo para que me puedan dar algun consejo.
FORMULARIO LOTE
html5
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> FORMULARIO LOTE </title> <link rel="stylesheet" href="../herramientas/calendario/system.css" /> <link rel="stylesheet" type="text/css" href="estilos/formscss.css"> <link rel="Stylesheet" href="estilos/formscss.css"> </head> <body> <form name="lote" method="post" action="form_lote.php" onSubmit="return validar(this)"> <table align="center" class="cuerpo" cellspacing="0" cellpadding="0"> <tr> <td> <table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" class="cuerpo3"> <tr class="titulo1"> </tr> <tr> <td align="center" valign="middle" > <input id="fch_ingreso" name="fch_ingreso" class="estil_caja" type="text" size="8%" title='Fecha de ingreso' readonly/> <img id='btn_fch_ingreso' title="Calendario para Seleccionar la Fecha de ingreso" src='../herramientas/calendario/calendario_1.gif' border='0' style="cursor:pointer" /> </td> </tr> </table> <p> <tr> <td colspan="5" align="center" > <input type='submit' name='boton' class='boton' value='Guardar'> </table> </form> <script type="text/javascript"> Zapatec.Calendar.setup({ weekNumbers : false, showOthers : true, showsTime : false, step : 1, electric : true, inputField : "fch_ingreso", button : "btn_fch_ingreso", timeFormat : 24, timeInterval : 05, ifFormat : '%Y-%m-%d', daFormat : '%Y-%m-%d' }); </script> </body> </html>
INSERT INTO FORMULARIO LOTE
php
<html xmlns="http://www.3w.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html:charset=utf-8"/> <title>form_lote</title> </head> <body> <?php $id_lote=$_POST["id_lote"]; $lote=$_POST["lote"]; $fch_ingreso=$_POST["fch_ingreso"]; $edad =$_POST["edad"]; //establesco la coneccion values('$lote','$fch_ingreso','$edad',)"); //header("location: formulario_lote.php"); print "<meta http-equiv=Refresh content="0 ; url=formulario_lote.php">"; ?> </body> </html>
EXTRAER FORMULARIO LOTE
php
<?php echo "<table width='100%' height'100%' border='' bgcolor=''> <tr bgcolor='#5F9EA0'><td>NRO. LOTE</td><td>FECHA INGRESO</td><td>EDAD ACTUAL </td></tr>"; { echo "<tr> <td> $fila[lote]</td> <td> $fila[fch_ingreso]</td> <td>$fila[edad]</td> } echo "</table>"; mysql_close($conectar); ?> </td> </tr> </table>
CALCULO DE TIEMPO EN SEMANAS
php
<?php $fecha = new DateTime(); $semana = $fecha->format('W'); // semana del año $semana ; echo ': '.$semana; // semana del año ?>