2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
In MySQL, you can get the current time in the following ways:
use NOW()
function:
SELECT NOW();
NOW()
The function returns the current date and time in the format'YYYY-MM-DD HH:MM:SS'
。
use CURRENT_TIMESTAMP
function:
SELECT CURRENT_TIMESTAMP;
Its effect is NOW()
Same as above, returns the current date and time.
use CURRENT_DATE
Function to get the current date:
SELECT CURRENT_DATE;
The return format is 'YYYY-MM-DD'
。
use CURRENT_TIME
The function gets the current time (excluding date):
SELECT CURRENT_TIME;
The return format is 'HH:MM:SS'
。
These functions can be used to obtain current time information with different precisions according to your specific needs.