|
|
@@ -103,7 +103,9 @@ class Conexion_Mysql {
|
|
103
|
103
|
$sqlValues .= "$valor,";
|
|
104
|
104
|
}
|
|
105
|
105
|
elseif (substr_count(MYSQL_TYPES_DATE, "$tipo_col ")) {
|
|
|
106
|
+ echo "<h2>$valor | $tipo_col</h2>";
|
|
106
|
107
|
$valor = $this->formatearFecha($valor, $tipo_col); // formatea las fechas
|
|
|
108
|
+
|
|
107
|
109
|
$sqlValues .= "'$valor',";
|
|
108
|
110
|
}
|
|
109
|
111
|
elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
|
|
|
@@ -115,7 +117,8 @@ class Conexion_Mysql {
|
|
115
|
117
|
$sqlValues = rtrim($sqlValues, ',').')';
|
|
116
|
118
|
|
|
117
|
119
|
// inserta los valores en la DB
|
|
118
|
|
- $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
|
|
|
120
|
+ $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
|
|
|
121
|
+ echo $sql;
|
|
119
|
122
|
return $this->ejecutarConsulta($sql);
|
|
120
|
123
|
}
|
|
121
|
124
|
|
|
|
@@ -199,10 +202,19 @@ class Conexion_Mysql {
|
|
199
|
202
|
* @return date Fecha para insertar en la BD.
|
|
200
|
203
|
*/
|
|
201
|
204
|
function formatearFecha($valor) {
|
|
202
|
|
-
|
|
203
|
|
- if (gettype($valor) == 'string') $valor = strtotime($valor);
|
|
|
205
|
+ if(!eregi("^.{4}\-.{2}\-.{2}\ .{2}\:.{2}\:.{2}$",$valor)){
|
|
|
206
|
+ if(eregi("^([0-9]+)$",$valor)){
|
|
|
207
|
+ $valor = date("Y-m-d H:i:s",$valor);
|
|
|
208
|
+ }else{
|
|
|
209
|
+ // Estariá en el formato strtotime()
|
|
|
210
|
+ $valor = date("Y-m-d H:i:s",strtotime($valor));
|
|
|
211
|
+ }
|
|
|
212
|
+ }
|
|
|
213
|
+ echo "<h4>($valor)</h4>";
|
|
|
214
|
+ return $valor;
|
|
|
215
|
+ /* if (gettype($valor) == 'string') $valor = strtotime($valor);
|
|
204
|
216
|
return date('Y-m-d H:i:s', $valor);
|
|
205
|
|
-
|
|
|
217
|
+ */
|
|
206
|
218
|
}
|
|
207
|
219
|
|
|
208
|
220
|
/**
|