Welcome Guest, Not a member yet? Register   Sign In
Shame on me : problem with date ...
#1

[eluser]xiii29[/eluser]
Hi !
Shame on me : I can(t save a date.
Here is the model :
Code:
$this->hasColumn('date', 'timestamp'); // I've try with date ...

In the controller :
Code:
$dateProposee->date = mktime(0,0,0,'23','12','2001');
I've try with new DateTime, create_date, etc...

And every time, I got 0000-00-00 00:00:00 in the database ...

Any help ?
#2

[eluser]danmontgomery[/eluser]
mktime produces a unix timestamp, which may be your problem. You might have better luck if you elaborate on what ORM you're using, and possibly post in that ORM's appropriate thread.
#3

[eluser]aquariuz[/eluser]
Check the order of the arguments in mktime(). Month goes before day.
#4

[eluser]xiii29[/eluser]
I'm using Doctrine.

I changed the order of the function but still not working ...
#5

[eluser]xiii29[/eluser]
I finnaly find a "solution" ...
Code:
$dateProposee->date = date_create($this->input->post('year') . '-' . $this->input->post('month') . '-' . $this->input->post('day'))->format('Y-m-d H:i:s');

And in the model :
Code:
$this->hasColumn('date', 'timestamp', 'Y-m-d H:i:s');

...




Theme © iAndrew 2016 - Forum software by © MyBB