I need to get the current time to insert it into the database, I have tried using the CI helper
$this->load->helper('date');
now();
I tried this function but it inserts me
00:00:00
Greetings thank you very much
I need to get the current time to insert it into the database, I have tried using the CI helper
$this->load->helper('date');
now();
I tried this function but it inserts me
00:00:00
Greetings thank you very much
Try with:
date("Y-m-d H:i:s")
The date()
function formats the current date / time.
More information about the possible formats that can be passed as a parameter in link
most likely the error you have in the construction of the TABLE in MySQl, What is the data type of the field (DATE, TIME, TIMESTAMP ...)?
Try doing an echo of the variable with the CodeIgniter time to see where the problem is coming from.
Another option is to set the time in MySQL
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,