In PHP, strftime() formats a timestamp in local time using C-style % format codes. It is deprecated and no longer available in modern PHP.
This function is deprecated as of PHP 8.1 (removal planned for a future PHP major). It is documented here so you can understand older code. For new code, use date() or IntlDateFormatter instead.
Syntax
Call strftime() with the values you need. Start with this line.
PHP
$text = strftime('%A, %d %B %Y', 1700000000);
Call
What it does
strftime('%A, %d %B %Y', 1700000000)
Returns "Tuesday, 14 November 2023" in the default C locale and UTC.
strftime('%H:%M', 1700000000)
Returns "22:13" in UTC.
strftime('%Y-%m-%d', 1700000000)
Returns "2023-11-14".
Do not use this function in new code. Use function_exists('strftime') while migrating old code. For English output, date() is enough. For translated month and day names, use IntlDateFormatter.
The timestamp falls on 5 November 2023, a single-digit day.
%e gives ' 5' with a leading space and %d gives '05' with a leading zero.
The fallback uses sprintf('%2d') to build the same space-padded value.
date('d') already gives the zero-padded form.
Example 3 — Modern Replacement with IntlDateFormatter
IntlDateFormatter formats dates for any locale. Use it when you need translated names. The fallback keeps the example working without the intl extension.