![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
Add10 minutes to MySQL datetime format?\n\n
Use DATE_ADD() to add 10 minutes to datetime format. Following is the syntax −
select date_add(yourColumnName ,interval 10 minute) from yourTableName;
Let us first create a table −
mysql> create table add10MinuteDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> DelayDatetime datetime -> ); Query OK, 0 rows affected (0.83 sec)
Following is the query to insert records in the table using insert command −
mysql> insert into add10MinuteDemo(DelayDatetime) values('2019-01-23 12:45:56'); Query OK, 1 row affected (0.16 sec) mysql> insert into add10MinuteDemo(DelayDatetime) values('2019-03-25 10:30:23'); Query OK, 1 row affected (0.19 sec) mysql> insert into add10MinuteDemo(DelayDatetime) values('2019-04-21 04:04:30'); Query OK, 1 row affected (0.19 sec)
Following is the query to display all records from the table using select statement −
mysql> select * from add10MinuteDemo;
This will produce the following output −
+----+---------------------+ | Id | DelayDatetime | +----+---------------------+ | 1 | 2019-01-23 12:45:56 | | 2 | 2019-03-25 10:30:23 | | 3 | 2019-04-21 04:04:30 | +----+---------------------+ 3 rows in set (0.00 sec)
Following is the query to add 10 minutes −
mysql> select date_add(DelayDatetime,interval 10 minute) from add10MinuteDemo;
This will produce the following output −
+--------------------------------------------+ | date_add(DelayDatetime,interval 10 minute) | +--------------------------------------------+ | 2019-01-23 12:55:56 | | 2019-03-25 10:40:23 | | 2019-04-21 04:14:30 | +--------------------------------------------+ 3 rows in set (0.00 sec)
Advertisements