Skip to content

Instantly share code, notes, and snippets.

View azett's full-sized avatar

Arvid Zimmermann azett

View GitHub Profile
@azett
azett / php-8.1-strftime.php
Created December 18, 2021 11:35 — forked from bohwaz/php-8.1-strftime.php
strftime() replacement function for PHP 8.1
<?php
namespace PHP81_BC;
/**
* 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.
* Note that output can be slightly different between libc sprintf and this function as it is using ICU.
*
* Usage:
* use func \PHP81_BC\strftime;
@azett
azett / Function.Date-Format-Conversion.php
Created December 18, 2021 11:27 — forked from mcaskill/Function.Date-Format-Conversion.php
PHP : Translate date/time format between `date()` and `strftime()`
<?php
/**
* Convert date/time format between `date()` and `strftime()`
*
* Timezone conversion is done for Unix. Windows users must exchange %z and %Z.
*
* Unsupported date formats : S, n, t, L, B, G, u, e, I, P, Z, c, r
* Unsupported strftime formats : %U, %W, %C, %g, %r, %R, %T, %X, %c, %D, %F, %x
*