Inserting NOW() into Database with CodeIgniter's Active Record

后端 未结 11 1005
傲寒
傲寒 2020-12-01 02:15

I want to insert current time in database using mySQL function NOW() in Codeigniter\'s active record. The following query won\'t work:

$data = array(
                


        
11条回答
  •  一整个雨季
    2020-12-01 03:18

    you can load the date helper and use the codeigniter interal now() if you want to reference the users GMT time offset

    it woulk look somewhat like this

    $data = array(
    'created_on' => date('Y-m-d H:i:s',now())
    );
    

    If you don't use the GTM master settings and let your users set their own offsets there is no advantage over using php's time() function.

提交回复
热议问题