We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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.



59.9k

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