Developing software in the Real World

Changing the format of a ZendForm DateTime element

If you want to change the format of the value of a DateTime element, the easiest way to do this in your Form class is to do this:

The two things to note:

  1. You can't set the format within the array – it has to be via a setFormat() call.
  2. If you change the format, you must set the min attribute in the same format, as otherwise it will try to set it with the hardcoded string of '1970-01-01T00:00Z' which will not work with your specified format.