mirror of
https://github.com/php/doc-ro.git
synced 2026-03-24 07:22:11 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ro/trunk@351055 c90b9560-bf6c-de11-be94-00142212c4b1
684 lines
29 KiB
XML
684 lines
29 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- $Author$ -->
|
|
<!-- EN-Revision: be5b0f33a18415823da76389915b49aae4ee6835 Maintainer: simionea Status: ready -->
|
|
<!-- CREDITS: adiju -->
|
|
|
|
<refentry xml:id="function.strftime" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>strftime</refname>
|
|
<refpurpose>Formatează o oră/dată locală în conformitate cu setările locale</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>strftime</methodname>
|
|
<methodparam><type>string</type><parameter>format</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>timestamp</parameter><initializer>time()</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Formatează ora și/sau data în conformitate cu setările locale. Denumirile
|
|
lunilor și a zilelor săptămânii și alte string-uri dependente de limbă sunt
|
|
în conformitate cu setările locale stabilite prin fincția
|
|
<function>setlocale</function>.
|
|
</para>
|
|
<para>
|
|
Nu toate specificările de convertire pot fi susținute de biblioteca
|
|
dumneavoastră C, în care caz ele nu vor fi susținute de funcția PHP
|
|
<function>strftime</function>. În plus, nu toate platformele susțin
|
|
timestamp-uri negative, de aceea domeniul de date poate fi limitat la valori
|
|
nu mai mici de Epoca Unix. Aceasta înseamnă că %e, %T, %R și %D (pot
|
|
fi mai multe), precum și date anterioare la <literal>Jan 1, 1970</literal> nu
|
|
vor funcționa în Windows, unele distibuții Linux, și alte câteva sisteme de
|
|
operare. Pentru sisteme Windows o privire de ansamblu a specificatorilor de
|
|
conversie susținuți poate fi găsită pe acest
|
|
<link xlink:href="&url.strftime.win32;">website <acronym>MSDN</acronym></link>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>format</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<table>
|
|
<title>Următoarele caractere sunt recunoscute în cadrul parametrului <parameter>format</parameter></title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry><parameter>format</parameter></entry>
|
|
<entry>Descriere</entry>
|
|
<entry>Exemplu de valori întoarse</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry align="center"><emphasis>Ziua</emphasis></entry>
|
|
<entry>---</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%a</literal></entry>
|
|
<entry>Reprezentarea textuală abreviată a zilei săptămânii</entry>
|
|
<entry>De la <literal>Sun</literal> până la <literal>Sat</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%A</literal></entry>
|
|
<entry>Reprezentarea textuală deplină a zilei săptămânii</entry>
|
|
<entry>De la <literal>Sunday</literal> până la <literal>Saturday</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%d</literal></entry>
|
|
<entry>Ziua lunii din două cifre (prefixată cu zero)</entry>
|
|
<entry>De la <literal>01</literal> până la <literal>31</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%e</literal></entry>
|
|
<entry>
|
|
Ziua lunii prefixată cu spațiu în cazul unei singure cifre.
|
|
Implementarea pentru Windows nu coincide cu descrierea. Găsiți mai
|
|
jos informații suplimentare.
|
|
</entry>
|
|
<entry>De la <literal> 1</literal> până la <literal>31</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%j</literal></entry>
|
|
<entry>Ziua anului, 3 cifre prefixate cu zerouri</entry>
|
|
<entry>De la <literal>001</literal> până la <literal>366</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%u</literal></entry>
|
|
<entry>Reprezentarea numerică a zilei săptămânii în conformitate cu ISO-8601</entry>
|
|
<entry>De la <literal>1</literal> (Luni) până la <literal>7</literal> (Duminică)</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%w</literal></entry>
|
|
<entry>Reprezentarea numerică a zilei săptămânii</entry>
|
|
<entry>De la <literal>0</literal> (Duminică) până la <literal>6</literal> (Sâmbătă)</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="center"><emphasis>Săptămâna</emphasis></entry>
|
|
<entry>---</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%U</literal></entry>
|
|
<entry>Numărul săptămânii anului dat. Prima Duminică din an este
|
|
începutul primei săptămâni</entry>
|
|
<entry><literal>13</literal> (pentru a 13-a săptămână deplină a anului)</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%V</literal></entry>
|
|
<entry>Numărul săptămânii anului dat în conformitate cu
|
|
ISO-8601:1988, începând cu prima săptămână a anului cu cel puțin 4
|
|
zile de lucru, ziua de Luni fiind prima zi a săptămânii</entry>
|
|
<entry>De la <literal>01</literal> până la <literal>53</literal>
|
|
(unde 53 reprezintă o săptămână suprapusă)</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%W</literal></entry>
|
|
<entry>Reprezentarea numerică a săptămânii din an, începând cu prima
|
|
zi de Luni ca prima săptămână</entry>
|
|
<entry><literal>46</literal> (pentru a 46-a săptămână a anului
|
|
începând cu Luni)</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="center"><emphasis>Luna</emphasis></entry>
|
|
<entry>---</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%b</literal></entry>
|
|
<entry>Denumirea abreviată a lunii bazată pe setările locale</entry>
|
|
<entry>De la <literal>Jan</literal> până la <literal>Dec</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%B</literal></entry>
|
|
<entry>Denumirea deplină a lunii bazată pe setările locale</entry>
|
|
<entry>De la <literal>January</literal> până la <literal>December</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%h</literal></entry>
|
|
<entry>Denumirea abreviată a lunii bazată pe setările locale (un
|
|
pseudonim pentru %b)</entry>
|
|
<entry>De la <literal>Jan</literal> până la <literal>Dec</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%m</literal></entry>
|
|
<entry>Reprezentarea din două cifre a lunii</entry>
|
|
<entry>De la <literal>01</literal> (Ianuarie) până la <literal>12</literal> (Decembrie)</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="center"><emphasis>Anul</emphasis></entry>
|
|
<entry>---</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%C</literal></entry>
|
|
<entry>Reprezentarea din două cifre a secolului (anul divizat la 100,
|
|
trunchiat până la un întreg)</entry>
|
|
<entry><literal>19</literal> pentru secolul 20</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%g</literal></entry>
|
|
<entry>Reprezentarea din două cifre a anului conform standardului ISO-8601:1988 (vezi %V)</entry>
|
|
<entry>Exemplu: <literal>09</literal> pentru 6 Ianuarie, 2009</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%G</literal></entry>
|
|
<entry>Versiunea deplină din patru cifre a %g</entry>
|
|
<entry>Exemplu: <literal>2008</literal> pentru 3 Ianuarie 2009</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%y</literal></entry>
|
|
<entry>Reprezentarea din două cifre a anului</entry>
|
|
<entry>Exemplu: <literal>09</literal> pentru 2009, <literal>79</literal> pentru 1979</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%Y</literal></entry>
|
|
<entry>Reprezentarea din patru cifre a anului</entry>
|
|
<entry>Exemplu: <literal>2038</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry align="center"><emphasis>Ora</emphasis></entry>
|
|
<entry>---</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%H</literal></entry>
|
|
<entry>Reprezentarea din două cifre a orei în formatul cu 24 de ore</entry>
|
|
<entry>De la <literal>00</literal> până la <literal>23</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%k</literal></entry>
|
|
<entry>Ora, în format cu 24 de ore, cu un spațiu în fața unei singure cifre</entry>
|
|
<entry>De la <literal> 0</literal> până la <literal>23</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%I</literal></entry>
|
|
<entry>Reprezentarea din două cifre a orei în formatul cu 12 ore</entry>
|
|
<entry>De la <literal>01</literal> până la <literal>12</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%l (litera minusculă 'L')</literal></entry>
|
|
<entry>Ora în formatul cu 12 ore, cu un spațiu înaintea orei cu o singură cifră</entry>
|
|
<entry>De la <literal> 1</literal> până la <literal>12</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%M</literal></entry>
|
|
<entry>Reprezentarea din două cifre a minutei</entry>
|
|
<entry>De la <literal>00</literal> până la <literal>59</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%p</literal></entry>
|
|
<entry>'AM' sau 'PM' cu litere majuscule în dependență de oră</entry>
|
|
<entry>Exemplu: <literal>AM</literal> pentru 00:31, <literal>PM</literal> pentru 22:23</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%P</literal></entry>
|
|
<entry>'am' sau 'pm' cu litere minuscule în dependență de oră</entry>
|
|
<entry>Exemplu: <literal>am</literal> pentru 00:31, <literal>pm</literal> pentru 22:23</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%r</literal></entry>
|
|
<entry>Echivalent cu "%I:%M:%S %p"</entry>
|
|
<entry>Exemplu: <literal>09:34:17 PM</literal> pentru 21:34:17</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%R</literal></entry>
|
|
<entry>Echivalent cu "%H:%M"</entry>
|
|
<entry>Exemplu: <literal>00:35</literal> pentru 12:35 AM, <literal>16:44</literal> pentru 4:44 PM</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%S</literal></entry>
|
|
<entry>Reprezentarea din două cifre a secundei</entry>
|
|
<entry>De la <literal>00</literal> până la <literal>59</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%T</literal></entry>
|
|
<entry>Echivalent cu "%H:%M:%S"</entry>
|
|
<entry>Exemplu: <literal>21:34:17</literal> pentru 09:34:17 PM</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%X</literal></entry>
|
|
<entry>Reprezentarea preferențială a orei în baza setărilor locale, fără dată</entry>
|
|
<entry>Exemplu: <literal>03:59:16</literal> sau <literal>15:59:16</literal></entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%z</literal></entry>
|
|
<entry>Deplasamentul fusului orar. Nu este implementat după cum este
|
|
descris în Windows. Vedeți mai jos pentru informații suplimentare.</entry>
|
|
<entry>Exemplu: <literal>-0500</literal> pentru US Eastern Time</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%Z</literal></entry>
|
|
<entry>Abrevierea fusului orar. Nu este implementat după cum este
|
|
descris în Windows. Vedeți mai jos pentru informații suplimentare.</entry>
|
|
<entry>Exemplu: <literal>EST</literal> pentru Eastern Time</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="center"><emphasis>Data și ora</emphasis></entry>
|
|
<entry>---</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%c</literal></entry>
|
|
<entry>Reprezentarea preferențială a datei și orei bazate pe setările locale</entry>
|
|
<entry>Exemplu: <literal>Tue Feb 5 00:45:10 2009</literal> pentru
|
|
5 februarie 2009, ora 12:45:10 AM</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%D</literal></entry>
|
|
<entry>Echivalent cu "%m/%d/%y"</entry>
|
|
<entry>Exemplu: <literal>02/05/09</literal> pentru February 5, 2009</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%F</literal></entry>
|
|
<entry>Echivalent cu "%Y-%m-%d" (utilizat deseori la bazele de date)</entry>
|
|
<entry>Exemplu: <literal>2009-02-05</literal> pentru February 5, 2009</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%s</literal></entry>
|
|
<entry>Momentul de timp după Epoca Unix (la fel ca și în cazul
|
|
funcției <function>time</function>)</entry>
|
|
<entry>Exemplu: <literal>305815200</literal> pentru September 10, 1979 08:40:00 AM</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%x</literal></entry>
|
|
<entry>Reprezentarea preferențială a datei în baza setărilor locale, fără oră</entry>
|
|
<entry>Exemplu: <literal>02/05/09</literal> pentru February 5, 2009</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="center"><emphasis>Diverse</emphasis></entry>
|
|
<entry>---</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%n</literal></entry>
|
|
<entry>Trecerea la linie nouă ("\n")</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%t</literal></entry>
|
|
<entry>Caracterul Tab ("\t")</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
<row>
|
|
<entry><literal>%%</literal></entry>
|
|
<entry>Caracterul "procent" ("%")</entry>
|
|
<entry>---</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<para>
|
|
Lungimea maximă a acestui parametru este de 1023 caractere.
|
|
</para>
|
|
<warning>
|
|
<simpara>
|
|
Contrar standardului ISO-9899:1999, Sun Solaris pune în corespondență
|
|
zilei de Duminică numărul 1. Ca rezultat, <literal>%u</literal> poate să
|
|
nu funcționeze după cum este descris în acest manual.
|
|
</simpara>
|
|
</warning>
|
|
<warning>
|
|
<para>
|
|
<emphasis>Doar pentru Windows:</emphasis>
|
|
</para>
|
|
<para>
|
|
Modificatorul <literal>%e</literal> nu este susținut în implementarea
|
|
Windows a acestei funcții. Pentru a obține un rezultat analogic,
|
|
utilizați modificatorul <literal>%#d</literal> în loc. Exemplul de mai
|
|
jos ilustrează modalitatea de a scrie o funcție compatibilă cu orice
|
|
platformă.
|
|
</para>
|
|
<para>
|
|
Modificatorii <literal>%z</literal> și <literal>%Z</literal> întorc
|
|
denumirea fusului orar, în loc de deplasament sau abreviere.
|
|
</para>
|
|
</warning>
|
|
<warning>
|
|
<simpara>
|
|
<emphasis>Doar pentru macOS:</emphasis> Modificatorul
|
|
<literal>%P</literal> nu este susținut în implementarea acestei funcții
|
|
pe macOS.
|
|
</simpara>
|
|
</warning>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
&date.timestamp.description;
|
|
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Întoarce un string formatat în corespundere cu parametrul
|
|
<parameter>format</parameter>, utilizând <parameter>timestamp</parameter>-ul
|
|
dat sau data și ora locală, dacă nu este furnizat un timestamp. Denumirile
|
|
lunilor și a zilelor săptămânii și alte string-uri dependente de limbă sunt
|
|
în corespundere cu setările locale stabilite cu
|
|
<function>setlocale</function>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
&date.timezone.errors.description;
|
|
<para>
|
|
Deoarece valoarea întoarsă depinde de biblioteca C ce stă la bază, unii
|
|
specificatori de conversie nu sunt susținuți. În Windows, furnizarea
|
|
specificatorilor de conversie necunoscuți va rezulta în 5 mesaje
|
|
<constant>E_WARNING</constant> și va întoarce &false;. În alte sisteme de
|
|
operare puteți să nu obțineți mesaje <constant>E_WARNING</constant> iar
|
|
rezultatul poate să conțină specificatorii de conversie neconvertiți.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
Acest exemplu va funcționa dacă aveți setările locale respective instalate
|
|
în sistem.
|
|
<example>
|
|
<title>Exemple <function>strftime</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
setlocale(LC_TIME, "C");
|
|
echo strftime("%A");
|
|
setlocale(LC_TIME, "fi_FI");
|
|
echo strftime(" in Finnish is %A,");
|
|
setlocale(LC_TIME, "fr_FR");
|
|
echo strftime(" in French %A and");
|
|
setlocale(LC_TIME, "de_DE");
|
|
echo strftime(" in German %A.\n");
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Exemplu al numerelor săptămânilor conform standardului ISO 8601:1988</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* December 2002 / January 2003
|
|
ISOWk M Tu W Thu F Sa Su
|
|
----- ----------------------------
|
|
51 16 17 18 19 20 21 22
|
|
52 23 24 25 26 27 28 29
|
|
1 30 31 1 2 3 4 5
|
|
2 6 7 8 9 10 11 12
|
|
3 13 14 15 16 17 18 19 */
|
|
|
|
// Afișează: 12/28/2002 - %V,%G,%Y = 52,2002,2002
|
|
echo "12/28/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y", strtotime("12/28/2002")) . "\n";
|
|
|
|
// Afișează: 12/30/2002 - %V,%G,%Y = 1,2003,2002
|
|
echo "12/30/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y", strtotime("12/30/2002")) . "\n";
|
|
|
|
// Afișează: 1/3/2003 - %V,%G,%Y = 1,2003,2003
|
|
echo "1/3/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2003")) . "\n";
|
|
|
|
// Afișează: 1/10/2003 - %V,%G,%Y = 2,2003,2003
|
|
echo "1/10/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/10/2003")) . "\n";
|
|
|
|
|
|
/* December 2004 / January 2005
|
|
ISOWk M Tu W Thu F Sa Su
|
|
----- ----------------------------
|
|
51 13 14 15 16 17 18 19
|
|
52 20 21 22 23 24 25 26
|
|
53 27 28 29 30 31 1 2
|
|
1 3 4 5 6 7 8 9
|
|
2 10 11 12 13 14 15 16 */
|
|
|
|
// Afișează: 12/23/2004 - %V,%G,%Y = 52,2004,2004
|
|
echo "12/23/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/23/2004")) . "\n";
|
|
|
|
// Afișează: 12/31/2004 - %V,%G,%Y = 53,2004,2004
|
|
echo "12/31/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/31/2004")) . "\n";
|
|
|
|
// Afișează: 1/2/2005 - %V,%G,%Y = 53,2004,2005
|
|
echo "1/2/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/2/2005")) . "\n";
|
|
|
|
// Afișează: 1/3/2005 - %V,%G,%Y = 1,2005,2005
|
|
echo "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n";
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Un exemplu de funcție compatibilă pe mai multe platforme, ce
|
|
utilizează modificatorul <literal>%e</literal></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// 1 Ian: rezultă în: '%e%1%' (%%, e, %%, %e, %%)
|
|
$format = '%%e%%%e%%';
|
|
|
|
// Verifică dacă se rulează pe Windows pentru a găsi
|
|
// și înlocui în mod corect modificatorul %e
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
|
$format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format);
|
|
}
|
|
|
|
echo strftime($format);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Afișează toate formatele cunoscute și necunoscute.</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// Describe the formats.
|
|
$strftimeFormats = array(
|
|
'A' => 'A full textual representation of the day',
|
|
'B' => 'Full month name, based on the locale',
|
|
'C' => 'Two digit representation of the century (year divided by 100, truncated to an integer)',
|
|
'D' => 'Same as "%m/%d/%y"',
|
|
'E' => '',
|
|
'F' => 'Same as "%Y-%m-%d"',
|
|
'G' => 'The full four-digit version of %g',
|
|
'H' => 'Two digit representation of the hour in 24-hour format',
|
|
'I' => 'Two digit representation of the hour in 12-hour format',
|
|
'J' => '',
|
|
'K' => '',
|
|
'L' => '',
|
|
'M' => 'Two digit representation of the minute',
|
|
'N' => '',
|
|
'O' => '',
|
|
'P' => 'lower-case "am" or "pm" based on the given time',
|
|
'Q' => '',
|
|
'R' => 'Same as "%H:%M"',
|
|
'S' => 'Two digit representation of the second',
|
|
'T' => 'Same as "%H:%M:%S"',
|
|
'U' => 'Week number of the given year, starting with the first Sunday as the first week',
|
|
'V' => 'ISO-8601:1988 week number of the given year, starting with the first week of the year with at least 4 weekdays, with Monday being the start of the week',
|
|
'W' => 'A numeric representation of the week of the year, starting with the first Monday as the first week',
|
|
'X' => 'Preferred time representation based on locale, without the date',
|
|
'Y' => 'Four digit representation for the year',
|
|
'Z' => 'The time zone offset/abbreviation option NOT given by %z (depends on operating system)',
|
|
'a' => 'An abbreviated textual representation of the day',
|
|
'b' => 'Abbreviated month name, based on the locale',
|
|
'c' => 'Preferred date and time stamp based on local',
|
|
'd' => 'Two-digit day of the month (with leading zeros)',
|
|
'e' => 'Day of the month, with a space preceding single digits',
|
|
'f' => '',
|
|
'g' => 'Two digit representation of the year going by ISO-8601:1988 standards (see %V)',
|
|
'h' => 'Abbreviated month name, based on the locale (an alias of %b)',
|
|
'i' => '',
|
|
'j' => 'Day of the year, 3 digits with leading zeros',
|
|
'k' => 'Hour in 24-hour format, with a space preceding single digits',
|
|
'l' => 'Hour in 12-hour format, with a space preceding single digits',
|
|
'm' => 'Two digit representation of the month',
|
|
'n' => 'A newline character ("\n")',
|
|
'o' => '',
|
|
'p' => 'UPPER-CASE "AM" or "PM" based on the given time',
|
|
'q' => '',
|
|
'r' => 'Same as "%I:%M:%S %p"',
|
|
's' => 'Unix Epoch Time timestamp',
|
|
't' => 'A Tab character ("\t")',
|
|
'u' => 'ISO-8601 numeric representation of the day of the week',
|
|
'v' => '',
|
|
'w' => 'Numeric representation of the day of the week',
|
|
'x' => 'Preferred date representation based on locale, without the time',
|
|
'y' => 'Two digit representation of the year',
|
|
'z' => 'Either the time zone offset from UTC or the abbreviation (depends on operating system)',
|
|
'%' => 'A literal percentage character ("%")',
|
|
);
|
|
|
|
// Results.
|
|
$strftimeValues = array();
|
|
|
|
// Evaluate the formats whilst suppressing any errors.
|
|
foreach($strftimeFormats as $format => $description){
|
|
if (False !== ($value = @strftime("%{$format}"))){
|
|
$strftimeValues[$format] = $value;
|
|
}
|
|
}
|
|
|
|
// Find the longest value.
|
|
$maxValueLength = 2 + max(array_map('strlen', $strftimeValues));
|
|
|
|
// Report known formats.
|
|
foreach($strftimeValues as $format => $value){
|
|
echo "Known format : '{$format}' = ", str_pad("'{$value}'", $maxValueLength), " ( {$strftimeFormats[$format]} )\n";
|
|
}
|
|
|
|
// Report unknown formats.
|
|
foreach(array_diff_key($strftimeFormats, $strftimeValues) as $format => $description){
|
|
echo "Unknown format : '{$format}' ", str_pad(' ', $maxValueLength), ($description ? " ( {$description} )" : ''), "\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Known format : 'A' = 'Friday' ( A full textual representation of the day )
|
|
Known format : 'B' = 'December' ( Full month name, based on the locale )
|
|
Known format : 'H' = '11' ( Two digit representation of the hour in 24-hour format )
|
|
Known format : 'I' = '11' ( Two digit representation of the hour in 12-hour format )
|
|
Known format : 'M' = '24' ( Two digit representation of the minute )
|
|
Known format : 'S' = '44' ( Two digit representation of the second )
|
|
Known format : 'U' = '48' ( Week number of the given year, starting with the first Sunday as the first week )
|
|
Known format : 'W' = '48' ( A numeric representation of the week of the year, starting with the first Monday as the first week )
|
|
Known format : 'X' = '11:24:44' ( Preferred time representation based on locale, without the date )
|
|
Known format : 'Y' = '2010' ( Four digit representation for the year )
|
|
Known format : 'Z' = 'GMT Standard Time' ( The time zone offset/abbreviation option NOT given by %z (depends on operating system) )
|
|
Known format : 'a' = 'Fri' ( An abbreviated textual representation of the day )
|
|
Known format : 'b' = 'Dec' ( Abbreviated month name, based on the locale )
|
|
Known format : 'c' = '12/03/10 11:24:44' ( Preferred date and time stamp based on local )
|
|
Known format : 'd' = '03' ( Two-digit day of the month (with leading zeros) )
|
|
Known format : 'j' = '337' ( Day of the year, 3 digits with leading zeros )
|
|
Known format : 'm' = '12' ( Two digit representation of the month )
|
|
Known format : 'p' = 'AM' ( UPPER-CASE "AM" or "PM" based on the given time )
|
|
Known format : 'w' = '5' ( Numeric representation of the day of the week )
|
|
Known format : 'x' = '12/03/10' ( Preferred date representation based on locale, without the time )
|
|
Known format : 'y' = '10' ( Two digit representation of the year )
|
|
Known format : 'z' = 'GMT Standard Time' ( Either the time zone offset from UTC or the abbreviation (depends on operating system) )
|
|
Known format : '%' = '%' ( A literal percentage character ("%") )
|
|
Unknown format : 'C' ( Two digit representation of the century (year divided by 100, truncated to an integer) )
|
|
Unknown format : 'D' ( Same as "%m/%d/%y" )
|
|
Unknown format : 'E'
|
|
Unknown format : 'F' ( Same as "%Y-%m-%d" )
|
|
Unknown format : 'G' ( The full four-digit version of %g )
|
|
Unknown format : 'J'
|
|
Unknown format : 'K'
|
|
Unknown format : 'L'
|
|
Unknown format : 'N'
|
|
Unknown format : 'O'
|
|
Unknown format : 'P' ( lower-case "am" or "pm" based on the given time )
|
|
Unknown format : 'Q'
|
|
Unknown format : 'R' ( Same as "%H:%M" )
|
|
Unknown format : 'T' ( Same as "%H:%M:%S" )
|
|
Unknown format : 'V' ( ISO-8601:1988 week number of the given year, starting with the first week of the year with at least 4 weekdays, with Monday being the start of the week )
|
|
Unknown format : 'e' ( Day of the month, with a space preceding single digits )
|
|
Unknown format : 'f'
|
|
Unknown format : 'g' ( Two digit representation of the year going by ISO-8601:1988 standards (see %V) )
|
|
Unknown format : 'h' ( Abbreviated month name, based on the locale (an alias of %b) )
|
|
Unknown format : 'i'
|
|
Unknown format : 'k' ( Hour in 24-hour format, with a space preceding single digits )
|
|
Unknown format : 'l' ( Hour in 12-hour format, with a space preceding single digits )
|
|
Unknown format : 'n' ( A newline character ("\n") )
|
|
Unknown format : 'o'
|
|
Unknown format : 'q'
|
|
Unknown format : 'r' ( Same as "%I:%M:%S %p" )
|
|
Unknown format : 's' ( Unix Epoch Time timestamp )
|
|
Unknown format : 't' ( A Tab character ("\t") )
|
|
Unknown format : 'u' ( ISO-8601 numeric representation of the day of the week )
|
|
Unknown format : 'v'
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<simpara>
|
|
%G și %V, care se bazează pe numerele săptămânilor conform standardului
|
|
ISO 8601:1988 pot oferi rezultate neașteptate (dar corecte) dacă sistemul
|
|
de numerotare nu este înțeles în detaliu. Vedeți exemplele %V în această
|
|
pagină a manualului.
|
|
</simpara>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><link xlink:href="&url.strftime.format.designer;">Instrumentul
|
|
online pentru proiectarea formatelor strftime()</link></member>
|
|
<member><function>setlocale</function></member>
|
|
<member><function>mktime</function></member>
|
|
<member><function>strptime</function></member>
|
|
<member><function>gmstrftime</function></member>
|
|
<member><link xlink:href="&spec.strftime;">Specificația Open Group a <function>strftime</function></link></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|