
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Add 2 Hours to Current Time in MySQL
We can get the current time with the help of now() and adding 2 hours is done by giving the interval as 2. Firstly, collect information of the current time in the system with the help of now(). The current time is .

The following is the query to get the current date and time.
mysql> select now();
Here is the output.
+---------------------+ | now() Â Â Â Â Â Â Â Â Â Â Â Â Â Â | +---------------------+ | 2018-11-01 12:58:40 | +---------------------+ 1 row in set (0.00 sec)
To add 2 hours in the current time, we will use the DATE_ADD() function.
mysql> select DATE_ADD(now(),interval 2 hour);
The following is the output that displays.
+---------------------------------+ | DATE_ADD(now(),interval 2 hour) | +---------------------------------+ | 2018-11-01 14:58:31 Â Â Â Â Â Â Â Â Â Â Â Â | +---------------------------------+ 1 row in set (0.00 sec)
Advertisements