Add DATE and TIME fields to get DATETIME field in MySQL

Anup picture Anup · Jul 22, 2010 · Viewed 10.7k times · Source

I am trying to get a DATETIME field from a DATE and a TIME field. none of the functions in MYSQL seems useful.

Is somebody aware how to do this or that if this can even be done? :)

Answer

Pekka picture Pekka · Jul 22, 2010

It should be as easy as

UPDATE table SET datetime_field = CONCAT(date_field, " ", time_field);