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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.