
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
MySQL query to insert current date plus specific time?
You can use CONCAT() for this. The syntax is as follows −
insert into DemoTable values(concat(curdate(), ' yourSpecificTime’));
Let us first create a table −
mysql> create table DemoTable ( ArrivalDate datetime ); Query OK, 0 rows affected (1.06 sec)
Insert some records in the table using insert command. We are adding the current date and time −
mysql> insert into DemoTable values(concat(curdate(), ' 10:20:05')); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values(concat(curdate(), ' 12:05:00')); Query OK, 1 row affected (0.17 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
Output
+---------------------+ | ArrivalDate | +---------------------+ | 2019-06-08 10:20:05 | | 2019-06-08 12:05:00 | +---------------------+ 2 rows in set (0.00 sec)
- Related Articles
- MySQL - Insert current date/time?
- How to insert current date/time in MySQL?
- Insert current time minus 1 hour to already inserted date-time records in MYSQL
- MySQL query to insert row with date?
- How to insert current date/ time using now() in a field with MySQL?
- Insert current date to the database in MySQL?
- MySQL query to select date >= current date - 3 weeks?
- Insert current date in datetime format MySQL?
- MySQL time period query to fetch date records from interval of 14 weeks from current date?
- MySQL query to get current datetime and only current date
- Filter query by current date in MySQL
- How to insert current date and time in a database using JDBC?
- Set current date and time to timestamp in MySQL
- How to multiple insert or batch insert at a time in MySQL query?
- MySQL query to get the current date records wherein one of the columns displays current date

Advertisements