Name

TIMESTAMP( )

Synopsis

TIMESTAMP(date, time)

This function returns date and time (in yyyy-mm-dd hh:mm:ss format) from a given string or column containing date and time data, respectively. If only the date or only the time is given, the function will return zeros for the missing parameters. This function is available as of Version 4.1.1 of MySQL.

SELECT TIMESTAMP(appt_date, appt_time)
   FROM appointments LIMIT 1;
+---------------------------------+
| TIMESTAMP(appt_date, appt_time) |
+---------------------------------+
| 2005-01-15 10:30:00             |
+---------------------------------+

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.