«
»

MYSQL, php

Convertir fecha string en datatime mysql.

08.22.13 | Comment?

Alberto Suárez Pérez

Supongamos que tenemos esta fecha en formato string 01/02/1986, para guardarla en formato datatime en mysql tenemos que convertirla.

 $inicial= "01/02/1986";
 $fecha = str_replace("/", "-",$_POST['FECHA']); 
 $date = date('Y-m-d H:i:s', strtotime($fecha)); 

Comments are closed.


«
»