저는 CodeIgniter 2.1.x와 MySQL을 사용하고 있습니다.
mysql 열 유형 DATETIME
과 TIMESTAMP
을 사용하는 사이에 많은 조언을 찾았지만 어떤 빌드를 실제로 사용하고 있는지 확실하지 않습니다.MySQL과 PHP에서 날짜와 시간을 처리하는 방법은 무엇입니까?
나는 사용자가 <form></form>
을 통해 Google지도에 마커를 추가 할 수있는 애플리케이션이 있습니다. 각 마커 제출 후 는 현재 시간이 기능을 사용하여 일일를 +해야 MySQL의 칼럼 date_created
및 date_end
기록해야합니다
class Maps extends CI_Controller{
...
public function marker($action = NULL, $slug = 'marker_add'){
...
if($this->form_validation->run() == TRUE){
$tomorrow = now() + 86400;
$data_markers = array(
'tid' => $this->input->post('formMarkType'),
'lat' => $this->input->post('formMarkLat'),
'lng' => $this->input->post('formMarkLng'),
'state' => 1,
'description' => $this->input->post('formMarkDescription'),
'date_end' => $tomorrow
);
$this->map_model->markers_add($data_markers);
redirect(site_url());
}
...
}
}
을하지만 I'am과 같이 설정 열 유형을 사용할 때 제대로 업데이트되지 않습니다 TIMESTAMP
또는 DATETIME
.
내가 뭘 잘못하고 있는거야?
도움이 될만한 이전 게시물 : http://stackoverflow.com/questions/409286/datetime-vs-timestamp – Revent