Check current date and time in MySQL / MariaDB

Find the list of commands which help to get the current today date and time in MySQL/MariaDB

MySQL [test]> select now();
+---------------------+
| now()               |
+---------------------+
| 2022-01-07 19:27:57 |
+---------------------+
1 row in set (0.000 sec)


MySQL [test]> select current_time;
+--------------+
| current_time |
+--------------+
| 19:27:42     |
+--------------+
1 row in set (0.000 sec)

MySQL [test]> select current_date;
+--------------+
| current_date |
+--------------+
| 2022-01-07   |
+--------------+
1 row in set (0.000 sec)

MySQL [test]> select current_timestamp;
+---------------------+
| current_timestamp   |
+---------------------+
| 2022-01-07 19:27:26 |
+---------------------+
1 row in set (0.000 sec)

MySQL [test]> select curtime();
+-----------+
| curtime() |
+-----------+
| 19:27:02  |
+-----------+
1 row in set (0.006 sec)

MySQL [test]> select curdate();
+------------+
| curdate()  |
+------------+
| 2022-01-07 |
+------------+
1 row in set (0.018 sec)

Leave a Reply