Insert date and time into mysql automatically?

2

I am creating a system and I would like to know how to fill in the form below and how do I insert the time and date in mysql as it is in the operating system.     

asked by anonymous 17.01.2017 / 00:13

1 answer

5

Just create a table with the date field of type TIMESTAMP and with the default value of CURRENT_TIMESTAMP

Follow sql example:

CREATE TABLE 'tabelateste' (
  'data' timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
)

That way, every time you enter a record, you do not have to enter the date, and it will be entered with the server system date

    
17.01.2017 / 00:18