- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to add 5 hours to current time in MySQL?
To add 5 hours in current time, we will use now() function from MySQL. The syntax is as follows −
SELECT date_add(now(),interval some integer value hour);
Now, I am applying the above query to add 5 hours to current time. The query is as follows −
mysql> SELECT date_add(now(),interval 5 hour);
The following is the output
+---------------------------------+ | date_add(now(),interval 5 hour) | +---------------------------------+ | 2018-10-11 15:59:23 | +---------------------------------+ 1 row in set (0.00 sec)
Look at the output above, it has increased the current time by 5 hours
Advertisements