February 2018
Intermediate to advanced
510 pages
16h 10m
English
NOW() is the function used to get the current date and time of the system:
mysql> SET @dt = NOW();
mysql> SELECT @dt;+---------------------+| @dt |+---------------------+| 2017-10-15 13:43:17 |+---------------------+
The DATE() function is used to extract date information from the DATETIME value:
mysql> SELECT DATE(@dt);+------------------+| DATE(@dt) |+------------------+| 2017-10-15 |+------------------+
The TIME() function is used to extract time information from a date time value:
mysql> SELECT TIME(@dt);+------------------+| TIME(@dt) |+------------------+| 13:43:17 |+------------------+
The DATE() and TIME() functions are very useful when you want to display or query a database table based on the date or time ...
Read now
Unlock full access