How can I set created and updated datetime in my Zend Form?

Hello everyone!
Framework Zend Framework (V. 2. 4. 11) Doctrine doctrine 2.1.
I am creating a news blog and now I have a problem - I need to save the creation date and the update date of my news, but I can not do it. I have 2 questions:

  1. How to create a field in the form for the date, so as not to enter values by hand, and choose, for example, from the calendar?
  2. How do I get and save date values? The update date is just the current date, and the publish date needs to be made possible for the user to change. In my Database, these dates are of type timestamp (without timezone).
public function setCreated()
        $this->created = new \DateTime("now");
        return $this->created;

I’m trying something like this, but when I call


Value is saving like NULL

You can use the Date or DateTimeLocal form elements:

See also:

This is outside of zend-form and is related to your model and / or Doctrine.

Use the built-in events of Doctrine