[DOC-CVS] [doc-en] master: gmstrftime: Fix example to match description and demonstrate locale handling (#5014)

[email protected] (Mikhail Alferov via GitHub) Mon, 11 May 2026 16:52:51 +0000
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Mikhail Alferov (mmalferov)
Committer: GitHub (web-flow)
Pusher: jordikroon
Date: 2026-05-11T18:52:48+02:00

Commit: https://github.com/php/doc-en/commit/6c27f7044c7d42c23685afa916e7d7a44cf2bbb2
Raw diff: https://github.com/php/doc-en/commit/6c27f7044c7d42c23685afa916e7d7a44cf2bbb2.diff

gmstrftime: Fix example to match description and demonstrate locale handling (#5014)

* gmstrftime.xml Fix example to match description and demonstrate locale handling

Changed paths:
  M  reference/datetime/functions/gmstrftime.xml


Diff:

diff --git a/reference/datetime/functions/gmstrftime.xml b/reference/datetime/functions/gmstrftime.xml
index 19f16fcf53c4..2520f3737850 100644
--- a/reference/datetime/functions/gmstrftime.xml
+++ b/reference/datetime/functions/gmstrftime.xml
@@ -93,19 +93,30 @@
 
  <refsect1 role="examples">
   &reftitle.examples;
-  <para>
-   <example>
-    <title><function>gmstrftime</function> example</title>
-    <programlisting role="php">
+  <example>
+   <title><function>gmstrftime</function> example</title>
+   <programlisting role="php">
 <![CDATA[
 <?php
-setlocale(LC_TIME, 'en_US');
-echo strftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n";
-echo gmstrftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n";
+
+setlocale(LC_TIME, 'es_ES.UTF-8');
+date_default_timezone_set('EST');
+
+echo strftime("%B %d %Y %H:%M:%S",   mktime(20, 0, 0, 12, 31, 98)) . "\n";
+echo gmstrftime("%B %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98));
 ]]>
-    </programlisting>
-   </example>
-  </para>
+   </programlisting>
+   &example.outputs;
+   <screen>
+<![CDATA[
+Deprecated: Function strftime() is deprecated since 8.1, use IntlDateFormatter::format() instead in script on line 6
+diciembre 31 1998 20:00:00
+
+Deprecated: Function gmstrftime() is deprecated since 8.1, use IntlDateFormatter::format() instead in script on line 7
+enero 01 1999 01:00:00
+]]>
+   </screen>
+  </example>
  </refsect1>
 
  <refsect1 role="seealso">