MySQL-获取当前日期时间 作者:马育民 • 2022-01-15 15:37 • 阅读:10065 # 日期时间 ### now ``` select now() ``` ``` select now() from dual ``` dual详见 [链接](https://www.malaoshi.top/show_1IX2b66DfdHA.html "链接") ### current_timestamp ``` select current_timestamp from dual ``` ``` select current_timestamp() from dual ``` # 日期 ### current_date ``` SELECT current_date() FROM dual ``` ``` SELECT current_date FROM dual ``` ### curdate() ``` SELECT CURDATE() FROM dual ``` # 时间 ### current_time ``` select current_time from dual ``` ``` select current_time() from dual ``` ### curtime() ``` SELECT curtime() FROM dual ``` # 将当前时间插入数据库 ``` insert into t_login(user_id,login_time) values (1,CURRENT_TIMESTAMP); ``` 原文出处:http://malaoshi.top/show_1IX2b5xulE9u.html