Adding date in database

Hi,

i am using vokuro and i added a new field in users table:

$user = new Users();
$user->assign(array(
                    'name' => $this->request->getPost('username', 'striptags'),
                    'email' => $this->request->getPost('email'),
                    'password' => $this->security->hash($this->request->getPost('password')),
                    'created_at'  => date('d-m-Y'),
                    'profilesId' => 2
));

When i, for example, set the date to 'name' it works, but not to 'created_at'.

Rgds

Stefan

It happens because in MySQL's databases date is stored in this form: date('Y-m-d'). And make sure you have correct data type set for created_at field in database.



19.6k

Hi Mr-Eluzive,

thank you for your answer.

Yes i know this, but i am using data type varchar and it won't work for created_at, but for username it works fine ... it is also varchar.

Rgds

Stefan



223

Answer is greate