Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/07/2014, 20:30
galaktico
 
Fecha de Ingreso: julio-2008
Mensajes: 57
Antigüedad: 15 años, 10 meses
Puntos: 0
Insertar Fecha y Hora con DatePicker y PHP

Buenas noches, con el date picker estoy insertando la fecha con el formato dateFormat: 'yy-mm-dd'.

Ejemplo: 2014-07-17.

Pero como en la base el campo es datetime necesito insertar la fecha y la hora.

Probé de esta manera pero no me funciona:

dateFormat: 'yy-mm-dd h:i:s'.

Lo que necesito es que quede así: 2014-07-17 23:15:13.

Se podrá concatenar la hora al hacer el Update?

El código del Update mío es:

Código PHP:
Ver original
  1. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  2.   $updateSQL = sprintf("UPDATE presupuestos SET fecha_inicio=%s, fecha_fin=%s WHERE id=%s",
  3.                        GetSQLValueString($_POST['fecha_inicio'], "text"),
  4.                        GetSQLValueString($_POST['fecha_fin'], "text"),
  5.                        GetSQLValueString($_POST['id'], "int"));


Y este es el código de mi formulario:

Código PHP:
Ver original
  1. <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  2.           <input name="fecha_inicio" type="text" id="fecha_inicio" value="<?php echo htmlentities($row_rs_detalle['fecha_inicio'], ENT_COMPAT, ''); ?>" size="32" />
  3.           <input name="fecha_fin" type="text" id="fecha_fin" value="<?php echo htmlentities($row_rs_detalle['fecha_fin'], ENT_COMPAT, ''); ?>" size="32" />
  4.           <input type="image" src="boton.jpg" />
  5.           <input type="hidden" name="MM_update" value="form1" />
  6.           <input type="hidden" name="id" value="<?php echo $row_rs_detalle['id']; ?>" />
  7.         </form>

Me podrán ayudar?

Muchas gracias!

Última edición por Triby; 17/07/2014 a las 20:40 Razón: Eliminar [QUOTE/]