Mega Code Archive

 
Categories / MySQL / String
 

Combining a Date and a Time into a Date-and-Time Value

mysql> mysql> mysql> SET @d = '2002-02-28'; Query OK, 0 rows affected (0.00 sec) mysql> SET @t = '13:10:05'; Query OK, 0 rows affected (0.00 sec) mysql> SELECT @d, @t, CONCAT(@d,' ',@t); +------------+----------+---------------------+ | @d         | @t       | CONCAT(@d,' ',@t)   | +------------+----------+---------------------+ | 2002-02-28 | 13:10:05 | 2002-02-28 13:10:05 | +------------+----------+---------------------+ 1 row in set (0.00 sec) mysql>