compat.functions.php
Miscellaneous support functions
Tags
Table of Contents
Functions
- strftime() : string
- Locale-formatted strftime using \IntlDateFormatter (PHP 8.1 compatible) This provides a cross-platform alternative to strftime() for when it will be removed from PHP.
Functions
strftime()
Locale-formatted strftime using \IntlDateFormatter (PHP 8.1 compatible) This provides a cross-platform alternative to strftime() for when it will be removed from PHP.
strftime(string $format[, null $timestamp = NULL ][, string|null $locale = NULL ]) : string
Note that output can be slightly different between libc sprintf and this function as it is using ICU.
Original use (a):
Usage: use function \PHP81_BC\strftime; echo strftime('%A %e %B %Y %X', new \DateTime('2021-09-28 00:00:00'), 'fr_FR');
Original use (b): \setlocale('fr_FR.UTF-8', LC_TIME); echo \strftime('%A %e %B %Y %X', strtotime('2021-09-28 00:00:00'));
Parameters
- $format : string
-
Date format
- $timestamp : null = NULL
-
Timestamp
- $locale : string|null = NULL