devxlogo

Getting the Current Date and Time in MySQL

Getting the Current Date and Time in MySQL

MySQL provides a NOW()?function that returns the current date and time when executed.

Command:

SELECT NOW() AS 'CURRENT DATE AND TIME';

Expected output:

+-------------------------+|CURRENT DATE AND TIME    |+-------------------------+|    2018-03-20 19:22:17  |+-------------------------+ 
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist