php - CodeIgniter - MySql timestamp/datetime keep giving me zeros when inserting -
i current using codeigniter 2.2.2 , have following code inside modal: $this->createdate = time(); $this->db->insert('somedb_table', $this); where createdate type timestamp (i tried datetime). giving me zeros when inserting inside db. there other way around this? such: 0000-00-00 00:00:00 try this(array input method) $my_array = array( 'database_field' => $this->input->post('input_form_field'), 'time_stamp' => date('y-m-d h:i:s'), ); $this->db->insert('somedb_table', $my_array);