Fix strftime deprecated after a PHP update
Function strftime() is deprecated means the date formatting function in use has been marked as obsolete.
Which PHP version does your site report?
We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.
More about this
The message alone does not mean every date is wrong or the website has stopped.
Record the page, email or export using the function.
In a WordPress theme, a date template is one place to investigate using the error line rather than the visible date alone.
Before you start
Save the complete error line and its timestamp in a private note. Record the action that failed, the current PHP version and any components updated at the same time. Share only information needed for the investigation.
Public support forums are not suitable places for customer details, access credentials or complete server paths.
Back up both files and the database before making changes. Check that the backup is usable. Work on a restricted test copy with the same PHP version and relevant settings.
Disable real payments and outgoing customer emails there. Agree who will make the change and who will check the result. These steps are an investigation guide, not a diagnosis of your particular website.
Causes and the PHP update
The strftime function has been deprecated since PHP 8.1. PHP lists IntlDateFormatter as an alternative for language-sensitive date formatting; date may suit other formatting needs. First establish whether month and weekday names need translation.
The choice concerns the required output, rather than merely replacing a function name. Check that the necessary extension is available in the environment that will run the replacement.
Choosing the correct repair
Ask the maintainer to specify language, time zone and intended format separately. Do not copy the old formatting pattern unchanged into another formatter: check the notation it expects. Do not change stored dates just to repair their display.
If a plugin uses the function, first look for a maintained release. Exercise a custom change everywhere the same date template is used.
Five steps to a repair
- Save the error line and locate the date display causing the call. Record the selected language, time zone and expected visible result on the test copy.
- Determine whether the date needs localized names. Ask the maintainer to choose an appropriate formatter and verify its availability in the hosting environment.
- Translate the formatting pattern for the selected formatter. Preserve the intended time zone and instant; do not also change scheduling rules or stored records.
- Test an ordinary date and one close to a day boundary. Compare the same appointment on the website, in a test message and in a relevant export.
- Confirm that the warning stays absent and all displayed dates match the appointment. Keep the language and time zone with the acceptance result.
A practical check
Consider an appointment plugin as a proposed test. Create an appointment on the test copy with a known date and time. Compare the calendar and confirmation in the configured language.
Also check an appointment near midnight using the agreed time zone. The test passes when the displayed day and time are correct and the stored appointment has not unexpectedly changed. This example does not establish a defect in a particular calendar or translation plugin.
Getting help and checking the repair
Use the help form below if you cannot access the logs or do not know who maintains the affected code. Describe one failed action and the expected result. Ask for a proposal that separates the cause, the change and the acceptance check.
Do not include passwords with your request.
After the repair, repeat the original action on the test copy. Also check a normal visitor journey, an empty result and invalid input where relevant. Review fresh log entries at the new test time.
Keep versions and outcomes in your maintenance notes. Let the responsible administrator decide when the tested change can be applied to the live website.
Choosing the next step
Use the links below this article to choose the next step. The PHP update page helps you discuss maintenance with the administrator. Use the Exposure Check to check your PHP version.
A public check may not identify a version; confirm it with your host when necessary. Do not treat its result as evidence that this programming error is repaired. Use the status page for current security information.
Keep the repair of the visitor action and the assessment of the server as separate checks in your notes. When requesting help, include the error text, the failed action and the expected result, but no passwords. Ask for one responsible person to oversee both the change and its acceptance.