Example
Extract the date part:
SELECT DATE("2017-06-15");
Definition and Usage
The DATE() function extracts the date part from a datetime expression.
Syntax
DATE(expression)
Extract the date part:
SELECT DATE("2017-06-15");
The DATE() function extracts the date part from a datetime expression.
DATE(expression)
Return current time:
SELECT CURTIME();
The CURTIME() function returns the current time.
Note: The time is returned as “HH-MM-SS” (string) or as HHMMSS.uuuuuu (numeric).
Return the current date and time:
SELECT CURRENT_TIMESTAMP();
The CURRENT_TIMESTAMP() function returns the current date and time.
Note: The date and time is returned as “YYYY-MM-DD HH-MM-SS” (string) or as YYYYMMDDHHMMSS.uuuuuu (numeric). Continue reading MySQL CURRENT_TIMESTAMP Function
Return current time:
SELECT CURRENT_TIME();
The CURRENT_TIME() function returns the current time.
Note: The time is returned as “HH-MM-SS” (string) or as HHMMSS.uuuuuu (numeric).
Return the current date:
SELECT CURRENT_DATE();
The CURRENT_DATE() function returns the current date.
Note: The date is returned as “YYYY-MM-DD” (string) or as YYYYMMDD (numeric).
Return the current date:
SELECT CURDATE();
The CURDATE() function returns the current date.
Note: The date is returned as “YYYY-MM-DD” (string) or as YYYYMMDD (numeric).
Add 2 seconds to a time and return the datetime:
SELECT ADDTIME("2017-06-15 09:34:21", "2");
The ADDTIME() function adds a time interval to a time/datetime and then returns the time/datetime. Continue reading MySQL ADDTIME Function
Add 10 days to a date and return the date:
SELECT ADDDATE("2017-06-15", INTERVAL 10 DAY);
The ADDDATE() function adds a time/date interval to a date and then returns the date. Continue reading MySQL ADDDATE Function
Return a number truncated to 2 decimal places:
SELECT TRUNCATE(135.375, 2);
The TRUNCATE() function truncates a number to the specified number of decimal places.
Return the tangent of a number:
SELECT TAN(1.75);
The TAN() function returns the tangent of a number. Continue reading MySQL TAN Function