¿Cuál es la forma recomendada de almacenar la hora actual usando PHP y MySQL?
Mi enfoque inicial fue:
$current = time(); // save this to column CURRENT_TIME with column type VARCHAR
//retrieve it like this
$retrieved = mysql_query(....) //assume query for getting the stored time value
$time = strtotime($retrieved);
Me he encontrado con los siguientes enfoques:
utilizargmstrftime
para manejar gmtutilizarINT
en lugar deVARCHAR
para la columnausa la función mysqlCURTIME
oCURDATE
utilizar elUNIX_TIMESTAMP
función mysqlninguno de los cuales estaba usando elDATETIME
oTIMESTAMP
tipo mysql var.
¿Tienes un mejor enfoque para este?