NOW() MySQL Function | MySQL

NOW() MySQL Function | MySQL

Today we are going to demonstrate MySQL now() function with various types of examples.
We will explore the MySQL now() function with MySQL queries to the database.

The MySQL NOW() is a very popular function and it is daily useable function. Mysql provide many date and time functions, you want to learn more about the date and time functions checkout this

MySQL NOW() Function

Basically MySQL NOW() is used to returns the current date and time. It will return the value of two types format, first is the YYYY-MM-DD HH:MM:SS and second is the YYYYMMDDHHMMSS format. But it depends on the function is used to string or numeric context.



Note: fsp is optional. It means fractional second precision.

Basic Example-1

Now we will take an example and explain it.



 | NOW()               |
 | 2019-07-14 11:17:58 |

Example-2 With FSP

Now we take another example with fsp argument or params.



 | NOW(3)                     |
 | 2019-07-14 05:12:06.095048 |

Example-4 | get current date data in MySQL

Now we take the next example with a database table. We take database table employees and get the current date data or record from the database table using MySQL NOW().

 SELECT name, created_at
 FROM employees 
 WHERE DATE(created_at) = DATE(NOW()) ORDER BY id DESC


The above Mysql query produces the result, see below :



Now we take the next example with a numeric context with NOW().



 | NOW() + 2      |
 | 20190714055004 |


We take another example of now() function when we used to numeric context with now() function. It will return the number value.

The below example, add 1 hour, minus -1 hour and add 1 day with current date and time.

 SELECT (NOW() - INTERVAL 1 HOUR) 'NOW - 1 hour',
 NOW() + INTERVAL 1 HOUR 'NOW + 1 hour';


Here, you have learned how to use MySQL NOW() function with various examples.

You may like

  1. LAST_DAY MySQL Function Examples
  2. MySQL CURRENT TIMESTAMP Function Examples
  3. Get month name from date in mysql
  4. mysql get first day of the current month
  5. mysql last day of previous month
  6. Get month number from month name in mysql
  7. mysql get day of week number from date
  8. Mysql Get Data Of Current Date, Week, Month, YEAR
  9. Query For Get Data Of Last Day, Week, Month, YEAR – Mysql

If you have any questions or thoughts to share, use the comment form below to reach us.


My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Javascript, JQuery, Laravel, Livewire, Codeigniter, Vue JS, Angular JS, React Js, WordPress, and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *