note 126970 added to function.strftime
| From: | eek at main dot php dot net | Date: | Tue, 05 Apr 2022 09:55:23 +0000 |
| Subject: | note 126970 added to function.strftime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218130@lists.php.net to get a copy of this message | ||
As of PHP 8.1 strftime is deprecated and due for removal in PHP9 due to concerns about locale
management, however no alternatives are mentioned as of yet.
As long as you are fine with numbers only or not being able to change languages for text parts like
weekdays you can migrate to the included date function [1]. Keep in mind their format string is
different [2]:
<?php echo strftime('%Y-%m-%d %H:%M:%S', time()); ?>
becomes
<?php echo date('Y-m-d H:i:s', time()); ?>
If you require the ability to switch languages IntlDateFormatter [3] from the Intl-extension might
help.
[1] https://www.php.net/manual/en/function.date.php
[2] https://www.php.net/manual/en/datetime.format.php
[3] https://www.php.net/manual/en/intldateformatter.create.php
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 2003:46:e028:fbea::9)
----
Manual Page -- https://php.net/manual/en/function.strftime.php
Edit -- https://main.php.net/note/edit/126970
Del: integrated -- https://main.php.net/note/delete/126970/integrated
Del: useless -- https://main.php.net/note/delete/126970/useless
Del: bad code -- https://main.php.net/note/delete/126970/bad+code
Del: spam -- https://main.php.net/note/delete/126970/spam
Del: non-english -- https://main.php.net/note/delete/126970/non-english
Del: in docs -- https://main.php.net/note/delete/126970/in+docs
Del: other reasons-- https://main.php.net/note/delete/126970
Reject -- https://main.php.net/note/reject/126970
Search -- https://main.php.net/manage/user-notes.php