Skip to content

Commit 6c27f70

Browse files
authored
gmstrftime: Fix example to match description and demonstrate locale handling (#5014)
* gmstrftime.xml Fix example to match description and demonstrate locale handling
1 parent 5f720ab commit 6c27f70

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

reference/datetime/functions/gmstrftime.xml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,30 @@
9393

9494
<refsect1 role="examples">
9595
&reftitle.examples;
96-
<para>
97-
<example>
98-
<title><function>gmstrftime</function> example</title>
99-
<programlisting role="php">
96+
<example>
97+
<title><function>gmstrftime</function> example</title>
98+
<programlisting role="php">
10099
<![CDATA[
101100
<?php
102-
setlocale(LC_TIME, 'en_US');
103-
echo strftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n";
104-
echo gmstrftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n";
101+
102+
setlocale(LC_TIME, 'es_ES.UTF-8');
103+
date_default_timezone_set('EST');
104+
105+
echo strftime("%B %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n";
106+
echo gmstrftime("%B %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98));
105107
]]>
106-
</programlisting>
107-
</example>
108-
</para>
108+
</programlisting>
109+
&example.outputs;
110+
<screen>
111+
<![CDATA[
112+
Deprecated: Function strftime() is deprecated since 8.1, use IntlDateFormatter::format() instead in script on line 6
113+
diciembre 31 1998 20:00:00
114+
115+
Deprecated: Function gmstrftime() is deprecated since 8.1, use IntlDateFormatter::format() instead in script on line 7
116+
enero 01 1999 01:00:00
117+
]]>
118+
</screen>
119+
</example>
109120
</refsect1>
110121

111122
<refsect1 role="seealso">

0 commit comments

Comments
 (0)