[dev] strftime deprecation
Ralf Lang
ralf.lang at ralf-lang.de
Sat Oct 8 13:40:45 UTC 2022
Hello,
I am thinking about the correct way to replace strftime calls in our
codebase.
The strftime function is deprecated.
It is aware of the currently set locale and uses a different way of
templating date strings than DateTimeInterface::format or
IntlDateFormatter::setPattern||
https://www.php.net/manual/de/intldateformatter.format.php
https://www.php.net/manual/de/datetime.format.php
In some places, date formats are defined by Horde's prefs
date_format
date_format_mini
time_format
time_format_mini
These settings are encoded in strftime mask formats and there are the
placeholders %X and %x to represent the locale's preferred date and time
settings.
There are three possible routes.
- Not deal with the issue now. Notices will be emitted and by PHP 9 this
will eventually break.
- Keep the prefs format and build a helper that adapts strftime-like
format strings to their DateTime equivalents.
- Change the actual prefs values to native DateTime formats. Requires
additional effort to upgrade existing pref data. Cleanest solution though.
Regards
Ralf
More information about the dev
mailing list