Welcome Guest, Not a member yet? Register   Sign In
timestamp
#1

[eluser]mehwish[/eluser]
hi please tell me how do i insert values in database field with type timestamp. Like i am doing this way in codeigniter
Code:
$user_poll_query=array(
                                'description'=>$poll_query,
                                     'creator_id'=>$user_id,
             'valid_from'=>date('Y-m-d H:i:s','1299762201428'),
                               );
         $this->db->insert('sl_polls',$user_poll_query);
but in databse i am getting 0s (0000-00-00 00.00.00)
#2

[eluser]fesweb[/eluser]
You are passing a string into the date() function, which requires a timestamp, or at least a number. Plus your unix timestamp is 3 digits too long.
Code:
'valid_from'=>date('Y-m-d H:i:s','1299762201428')
// should be more like this...
'valid_from'=>date('Y-m-d H:i:s', 1299762201) // no quotes
// or...
'valid_from'=>date('Y-m-d H:i:s', strtotime('2009-02-01'))




Theme © iAndrew 2016 - Forum software by © MyBB