Propel2
Propel2 copied to clipboard
Temporal column getter doesn't support strftime format anymore
The generated doc comment of the get method of a temporal type column still says this about the $format parameter: "The date/time format string (either date()-style or strftime()-style).".
It seems however that only date()-style is supported, as the format is passed to the format method of the DateTime object. (This used to be different in Propel 1.)
Will support for strtime come back (which is my preferred way of formatting because of localization support)?
Will support for strtime come back (which is my preferred way of formatting because of localization support)?
\DateTime
is the way you should use propel temporal columns, so the answer is no :)
You should do something like $model->getDateTimeColumn()->setTimezone(...)->format(...);
for localization.
Maybe this could be a PR for docs?
Turns out, you can pretty easily add strftime-based getters to all tables through behaviors.
See https://github.com/mringler/propel-generate-strftime-getters-behavior