I want to insert data in sql but i want that the time to be the current date and to be inserted by itself in the date column.If yes,can u refer me somthing?
Asked
Active
Viewed 59 times
-1
-
Please clarify your question by showing us some actual data, or something else, which would explain what you need. – Tim Biegeleisen Sep 08 '18 at 14:01
-
Possible duplicate of [MySQL - insert current date/time?](https://stackoverflow.com/questions/19246309/mysql-insert-current-date-time) – Solaiman Sep 08 '18 at 14:02
1 Answers
1
Use the built-in NOW()
MySQL function to insert the current date.
Here's an example, suppose you have a date
column in your table that you want to store the current date in it:
INSERT INTO `table_name`(`col1`, col2, `current_date_col`)
VALUES ('data', 'another data', NOW())
This results in something like this:
col1 | col1 | current_date_col
______|________|____________________
| |
data | data | 2018-09-08 15:44:36

ThS
- 4,597
- 2
- 15
- 27