[GENERIC] Zend_Translate:
[zend.git] / documentation / manual / en / module_specs / Zend_Date-Constants.xml
blob7333028d8d12b438570eafbece0b751cafd3a912
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- Reviewed: no -->
3 <sect1 id="zend.date.constants">
4     <title>Constants for General Date Functions</title>
6     <para>
7         Whenever a <classname>Zend_Date</classname> method has a <varname>$parts</varname>
8         parameter, one of the constants below can be used as the argument for that parameter, in
9         order to select a specific part of a date or indicate the date format used or desired (e.g.
10         <acronym>RFC</acronym> 822).
11     </para>
13     <sect2 id="zend.date.constants.using">
14         <title>Using Constants</title>
16         <para>
17             For example, the constant <constant>Zend_Date::HOUR</constant> can be used in the ways
18             shown below. When working with days of the week, calendar dates, hours, minutes,
19             seconds, and any other date parts that are expressed differently when in different parts
20             of the world, the object's timezone will automatically be used to compute the correct
21             value, even though the internal timestamp is the same for the same moment in time,
22             regardless of the user's physical location in the world. Regardless of the units
23             involved, output must be expressed either as <acronym>GMT</acronym> or
24             <acronym>UTC</acronym> or localized to a locale. The example output below reflects
25             localization to Europe/GMT+1 hour (e.g. Germany, Austria, France).
26         </para>
28         <table id="zend.date.constants.using.table">
29             <title>Operations Involving Zend_Date::HOUR</title>
31             <tgroup cols="4">
32                 <thead>
33                     <row>
34                         <entry>Method</entry>
35                         <entry>Description</entry>
36                         <entry>Original date</entry>
37                         <entry>Result</entry>
38                     </row>
39                 </thead>
41                 <tbody>
42                     <row>
43                         <entry><methodname>get(Zend_Date::HOUR)</methodname></entry>
44                         <entry>Output of the hour</entry>
45                         <entry>2009-02-13T14:53:27+01:00</entry>
46                         <entry>14</entry>
47                     </row>
49                     <row>
50                         <entry><methodname>set(12, Zend_Date::HOUR)</methodname></entry>
51                         <entry>Set new hour</entry>
52                         <entry>2009-02-13T14:53:27+01:00</entry>
53                         <entry>2009-02-13T12:53:27+01:00</entry>
54                     </row>
56                     <row>
57                         <entry><methodname>add(12, Zend_Date::HOUR)</methodname></entry>
58                         <entry>Add hours</entry>
59                         <entry>2009-02-13T14:53:27+01:00</entry>
60                         <entry>2009-02-14T02:53:27+01:00</entry>
61                     </row>
63                     <row>
64                         <entry><methodname>sub(12, Zend_Date::HOUR)</methodname></entry>
65                         <entry>Subtract hours</entry>
66                         <entry>2009-02-13T14:53:27+01:00</entry>
67                         <entry>2009-02-13T02:53:27+01:00</entry>
68                     </row>
70                     <row>
71                         <entry><methodname>compare(12, Zend_Date::HOUR)</methodname></entry>
72                         <entry>Compare hour, returns 0, 1 or -1</entry>
73                         <entry>2009-02-13T14:53:27+01:00</entry>
74                         <entry>1 (if object > argument)</entry>
75                     </row>
77                     <row>
78                         <entry><methodname>copy(Zend_Date::HOUR)</methodname></entry>
79                         <entry>Copies only the hour part</entry>
80                         <entry>2009-02-13T14:53:27+01:00</entry>
81                         <entry>1970-01-01T14:00:00+01:00</entry>
82                     </row>
84                     <row>
85                         <entry><methodname>equals(14, Zend_Date::HOUR)</methodname></entry>
86                         <entry>Compares the hour, returns <constant>TRUE</constant> or
87                         <constant>FALSE</constant></entry> <entry>2009-02-13T14:53:27+01:00</entry>
88                         <entry><constant>TRUE</constant></entry>
89                     </row>
91                     <row>
92                         <entry><methodname>isEarlier(12, Zend_Date::HOUR)</methodname></entry>
93                         <entry>Compares the hour, returns <constant>TRUE</constant> or
94                         <constant>FALSE</constant></entry> <entry>2009-02-13T14:53:27+01:00</entry>
95                         <entry><constant>TRUE</constant></entry>
96                     </row>
98                     <row>
99                         <entry><methodname>isLater(12, Zend_Date::HOUR)</methodname></entry>
100                         <entry>Compares the hour, returns <constant>TRUE</constant> or
101                         <constant>FALSE</constant></entry> <entry>2009-02-13T14:53:27+01:00</entry>
102                         <entry><constant>FALSE</constant></entry>
103                     </row>
104                 </tbody>
105             </tgroup>
106         </table>
107     </sect2>
109     <sect2 id="zend.date.constants.list">
110         <title>List of All Constants</title>
112         <para>
113             Each part of a date or time has a unique constant in <classname>Zend_Date</classname>.
114             All constants supported by <classname>Zend_Date</classname> are listed below.
115         </para>
117         <table id="zend.date.constants.list.table-1">
118             <title>Day Constants</title>
120             <tgroup cols="4">
121                 <thead>
122                     <row>
123                         <entry>Constant</entry>
124                         <entry>Description</entry>
125                         <entry>Date</entry>
126                         <entry>Result</entry>
127                     </row>
128                 </thead>
130                 <tbody>
131                     <row>
132                         <entry><constant>Zend_Date::DAY</constant></entry>
133                         <entry>Day (as number, two digits)</entry>
134                         <entry>2009-02-13T14:53:27+01:00</entry>
135                         <entry><emphasis>13</emphasis></entry>
136                     </row>
138                     <row>
139                         <entry><constant>Zend_Date::DAY_SHORT</constant></entry>
140                         <entry>Day (as number, one or two digits)</entry>
141                         <entry>2009-02-06T14:53:27+01:00</entry>
142                         <entry><emphasis>6</emphasis></entry>
143                     </row>
145                     <row>
146                         <entry><constant>Zend_Date::WEEKDAY</constant></entry>
147                         <entry>Weekday (Name of the day, localized, complete)</entry>
148                         <entry>2009-02-13T14:53:27+01:00</entry>
149                         <entry><emphasis>Friday</emphasis></entry>
150                     </row>
152                     <row>
153                         <entry><constant>Zend_Date::WEEKDAY_SHORT</constant></entry>
155                         <entry>
156                             Weekday (Name of the day, localized, abbreviated, two to four chars)
157                         </entry>
159                         <entry>2009-02-13T14:53:27+01:00</entry>
160                         <entry><emphasis>Fri</emphasis> for Friday</entry>
161                     </row>
163                     <row>
164                         <entry><constant>Zend_Date::WEEKDAY_NAME</constant></entry>
166                         <entry>
167                             Weekday (Name of the day, localized, abbreviated, one or two chars)
168                         </entry>
170                         <entry>2009-02-13T14:53:27+01:00</entry>
171                         <entry><emphasis>Fr</emphasis> for Friday</entry>
172                     </row>
174                     <row>
175                         <entry><constant>Zend_Date::WEEKDAY_NARROW</constant></entry>
177                         <entry>
178                             Weekday (Name of the day, localized, abbreviated, one char)
179                         </entry>
181                         <entry>2009-02-13T14:53:27+01:00</entry>
182                         <entry><emphasis>F</emphasis> for Friday</entry>
183                     </row>
185                     <row>
186                         <entry><constant>Zend_Date::WEEKDAY_DIGIT</constant></entry>
187                         <entry>Weekday (0 = Sunday, 6 = Saturday)</entry>
188                         <entry>2009-02-13T14:53:27+01:00</entry>
189                         <entry><emphasis>5</emphasis> for Friday</entry>
190                     </row>
192                     <row>
193                         <entry><constant>Zend_Date::WEEKDAY_8601</constant></entry>
195                         <entry>
196                             Weekday according to <acronym>ISO</acronym> 8601 (1 = Monday, 7 =
197                             Sunday)
198                         </entry>
200                         <entry>2009-02-13T14:53:27+01:00</entry>
201                         <entry><emphasis>5</emphasis> for Friday</entry>
202                     </row>
204                     <row>
205                         <entry><constant>Zend_Date::DAY_OF_YEAR</constant></entry>
206                         <entry>Day (as a number, one or two digits)</entry>
207                         <entry>2009-02-13T14:53:27+01:00</entry>
208                         <entry><emphasis>43</emphasis>
209                         </entry>
210                     </row>
212                     <row>
213                         <entry><constant>Zend_Date::DAY_SUFFIX</constant></entry>
214                         <entry>English addendum for the day (st, nd, rd, th)</entry>
215                         <entry>2009-02-13T14:53:27+01:00</entry>
216                         <entry><emphasis>th</emphasis></entry>
217                     </row>
218                 </tbody>
219             </tgroup>
220         </table>
222         <table id="zend.date.constants.list.table-2">
223             <title>Week Constants</title>
225             <tgroup cols="4">
226                 <thead>
227                     <row>
228                         <entry>Constant</entry>
229                         <entry>Description</entry>
230                         <entry>Date</entry>
231                         <entry>Result</entry>
232                     </row>
233                 </thead>
235                 <tbody>
236                     <row>
237                         <entry><constant>Zend_Date::WEEK</constant></entry>
238                         <entry>Week (as number, 1-53)</entry>
239                         <entry>2009-02-13T14:53:27+01:00</entry>
240                         <entry><emphasis>8</emphasis></entry>
241                     </row>
242                 </tbody>
243             </tgroup>
244         </table>
246         <table id="zend.date.constants.list.table-3">
247             <title>Month Constants</title>
249             <tgroup cols="4">
250                 <thead>
251                     <row>
252                         <entry>Constant</entry>
253                         <entry>Description</entry>
254                         <entry>Date</entry>
255                         <entry>Result</entry>
256                     </row>
257                 </thead>
259                 <tbody>
260                     <row>
261                         <entry><constant>Zend_Date::MONTH_NAME</constant></entry>
262                         <entry>Month (Name of the month, localized, complete)</entry>
263                         <entry>2009-02-13T14:53:27+01:00</entry>
264                         <entry><emphasis>February</emphasis></entry>
265                     </row>
267                     <row>
268                         <entry><constant>Zend_Date::MONTH_NAME_SHORT</constant></entry>
270                         <entry>
271                             Month (Name of the month, localized, abbreviated, two to four chars)
272                         </entry>
274                         <entry>2009-02-13T14:53:27+01:00</entry>
275                         <entry><emphasis>Feb</emphasis></entry>
276                     </row>
278                     <row>
279                         <entry><constant>Zend_Date::MONTH_NAME_NARROW</constant></entry>
281                         <entry>
282                             Month (Name of the month, localized, abbreviated, one or two chars)
283                         </entry>
285                         <entry>2009-02-13T14:53:27+01:00</entry>
286                         <entry><emphasis>F</emphasis></entry>
287                     </row>
289                     <row>
290                         <entry><constant>Zend_Date::MONTH</constant></entry>
291                         <entry>Month (Number of the month, two digits)</entry>
292                         <entry>2009-02-13T14:53:27+01:00</entry>
293                         <entry><emphasis>02</emphasis></entry>
294                     </row>
296                     <row>
297                         <entry><constant>Zend_Date::MONTH_SHORT</constant></entry>
298                         <entry>Month (Number of the month, one or two digits)</entry>
299                         <entry>2009-02-13T14:53:27+01:00</entry>
300                         <entry><emphasis>2</emphasis></entry>
301                     </row>
303                     <row>
304                         <entry><constant>Zend_Date::MONTH_DAYS</constant></entry>
305                         <entry>Number of days for this month (number)</entry>
306                         <entry>2009-02-13T14:53:27+01:00</entry>
307                         <entry><emphasis>28</emphasis></entry>
308                     </row>
309                 </tbody>
310             </tgroup>
311         </table>
313         <table id="zend.date.constants.list.table-4">
314             <title>Year Constants</title>
316             <tgroup cols="4">
317                 <thead>
318                     <row>
319                         <entry>Constant</entry>
320                         <entry>Description</entry>
321                         <entry>Date</entry>
322                         <entry>Result</entry>
323                     </row>
324                 </thead>
326                 <tbody>
327                     <row>
328                         <entry><constant>Zend_Date::YEAR</constant></entry>
329                         <entry>Year (number)</entry>
330                         <entry>2009-02-13T14:53:27+01:00</entry>
331                         <entry><emphasis>2009</emphasis></entry>
332                     </row>
334                     <row>
335                         <entry><constant>Zend_Date::YEAR_8601</constant></entry>
336                         <entry>Year according to <acronym>ISO</acronym> 8601 (number)</entry>
337                         <entry>2009-02-13T14:53:27+01:00</entry>
338                         <entry><emphasis>2009</emphasis></entry>
339                     </row>
341                     <row>
342                         <entry><constant>Zend_Date::YEAR_SHORT</constant></entry>
343                         <entry>Year (number, two digits)</entry>
344                         <entry>2009-02-13T14:53:27+01:00</entry>
345                         <entry><emphasis>09</emphasis></entry>
346                     </row>
348                     <row>
349                         <entry><constant>Zend_Date::YEAR_SHORT_8601</constant></entry>
351                         <entry>
352                             Year according to <acronym>ISO</acronym> 8601 (number, two digits)
353                         </entry>
355                         <entry>2009-02-13T14:53:27+01:00</entry>
356                         <entry><emphasis>09</emphasis></entry>
357                     </row>
359                     <row>
360                         <entry><constant>Zend_Date::LEAPYEAR</constant></entry>
362                         <entry>
363                             Is the year a leap year? (<constant>TRUE</constant> or
364                             <constant>FALSE</constant>)
365                         </entry>
367                         <entry>2009-02-13T14:53:27+01:00</entry>
368                         <entry><constant>FALSE</constant></entry>
369                     </row>
370                 </tbody>
371             </tgroup>
372         </table>
374         <table id="zend.date.constants.list.table-5">
375             <title>Time Constants</title>
377             <tgroup cols="4">
378                 <thead>
379                     <row>
380                         <entry>Constant</entry>
381                         <entry>Description</entry>
382                         <entry>Date</entry>
383                         <entry>Result</entry>
384                     </row>
385                 </thead>
387                 <tbody>
388                     <row>
389                         <entry><constant>Zend_Date::HOUR</constant></entry>
390                         <entry>Hour (00-23, two digits)</entry>
391                         <entry>2009-02-13T14:53:27+01:00</entry>
392                         <entry><emphasis>14</emphasis></entry>
393                     </row>
395                     <row>
396                         <entry><constant>Zend_Date::HOUR_SHORT</constant></entry>
397                         <entry>Hour (0-23, one or two digits)</entry>
398                         <entry>2009-02-13T14:53:27+01:00</entry>
399                         <entry><emphasis>14</emphasis></entry>
400                     </row>
402                     <row>
403                         <entry><constant>Zend_Date::HOUR_SHORT_AM</constant></entry>
404                         <entry>Hour (1-12, one or two digits)</entry>
405                         <entry>2009-02-13T14:53:27+01:00</entry>
406                         <entry><emphasis>2</emphasis></entry>
407                     </row>
409                     <row>
410                         <entry><constant>Zend_Date::HOUR_AM</constant></entry>
411                         <entry>Hour (01-12, two digits)</entry>
412                         <entry>2009-02-13T14:53:27+01:00</entry>
413                         <entry><emphasis>02</emphasis></entry>
414                     </row>
416                     <row>
417                         <entry><constant>Zend_Date::MINUTE</constant></entry>
418                         <entry>Minute (00-59, two digits)</entry>
419                         <entry>2009-02-13T14:53:27+01:00</entry>
420                         <entry><emphasis>53</emphasis></entry>
421                     </row>
423                     <row>
424                         <entry><constant>Zend_Date::MINUTE_SHORT</constant></entry>
425                         <entry>Minute (0-59, one or two digits)</entry>
426                         <entry>2009-02-13T14:03:27+01:00</entry>
427                         <entry><emphasis>3</emphasis></entry>
428                     </row>
430                     <row>
431                         <entry><constant>Zend_Date::SECOND</constant></entry>
432                         <entry>Second (00-59, two digits)</entry>
433                         <entry>2009-02-13T14:53:27+01:00</entry>
434                         <entry><emphasis>27</emphasis></entry>
435                     </row>
437                     <row>
438                         <entry><constant>Zend_Date::SECOND_SHORT</constant></entry>
439                         <entry>Second (0-59, one or two digits)</entry>
440                         <entry>2009-02-13T14:53:07+01:00</entry>
441                         <entry><emphasis>7</emphasis></entry>
442                     </row>
444                     <row>
445                         <entry><constant>Zend_Date::MILLISECOND</constant></entry>
446                         <entry>Millisecond (theoretically infinite)</entry>
447                         <entry><command>2009-02-06T14:53:27.20546</command></entry>
448                         <entry><emphasis>20546</emphasis></entry>
449                     </row>
451                     <row>
452                         <entry><constant>Zend_Date::MERIDIEM</constant></entry>
453                         <entry>Time of day (forenoon or afternoon)</entry>
454                         <entry>2009-02-13T14:53:27+01:00</entry>
455                         <entry><emphasis>afternoon</emphasis></entry>
456                     </row>
458                     <row>
459                         <entry><constant>Zend_Date::SWATCH</constant></entry>
460                         <entry>Swatch Internet Time</entry>
461                         <entry>2009-02-13T14:53:27+01:00</entry>
462                         <entry><emphasis>620</emphasis></entry>
463                     </row>
464                 </tbody>
465             </tgroup>
466         </table>
468         <table id="zend.date.constants.list.table-6">
469             <title>Timezone Constants</title>
471             <tgroup cols="4">
472                 <thead>
473                     <row>
474                         <entry>Constant</entry>
475                         <entry>Description</entry>
476                         <entry>Date</entry>
477                         <entry>Result</entry>
478                     </row>
479                 </thead>
481                 <tbody>
482                     <row>
483                         <entry><constant>Zend_Date::TIMEZONE</constant></entry>
484                         <entry>Name der time zone (string, abbreviated)</entry>
485                         <entry>2009-02-13T14:53:27+01:00</entry>
486                         <entry><emphasis><acronym>CET</acronym></emphasis></entry>
487                     </row>
489                     <row>
490                         <entry><constant>Zend_Date::TIMEZONE_NAME</constant></entry>
491                         <entry>Name of the time zone (string, complete)</entry>
492                         <entry>2009-02-13T14:53:27+01:00</entry>
493                         <entry><emphasis><command>Europe/Paris</command></emphasis></entry>
494                     </row>
496                     <row>
497                         <entry><constant>Zend_Date::TIMEZONE_SECS</constant></entry>
499                         <entry>
500                             Difference of the time zone to <acronym>GMT</acronym> in seconds
501                             (integer)
502                         </entry>
504                         <entry>2009-02-13T14:53:27+01:00</entry>
505                         <entry><emphasis>3600</emphasis> (seconds to <acronym>GMT</acronym>)</entry>
506                     </row>
508                     <row>
509                         <entry><constant>Zend_Date::GMT_DIFF</constant></entry>
510                         <entry>Difference to <acronym>GMT</acronym> in seconds (string)</entry>
511                         <entry>2009-02-13T14:53:27+01:00</entry>
512                         <entry><emphasis>+0100</emphasis></entry>
513                     </row>
515                     <row>
516                         <entry><constant>Zend_Date::GMT_DIFF_SEP</constant></entry>
518                         <entry>
519                             Difference to <acronym>GMT</acronym> in seconds (string, separated)
520                         </entry>
522                         <entry>2009-02-13T14:53:27+01:00</entry>
523                         <entry><emphasis>+01:00</emphasis></entry>
524                     </row>
526                     <row>
527                         <entry><constant>Zend_Date::DAYLIGHT</constant></entry>
529                         <entry>
530                             Summer time or Winter time? (<constant>TRUE</constant> or
531                             <constant>FALSE</constant>)
532                         </entry>
534                         <entry>2009-02-13T14:53:27+01:00</entry>
535                         <entry><constant>FALSE</constant></entry>
536                     </row>
537                 </tbody>
538             </tgroup>
539         </table>
541         <table id="zend.date.constants.list.table-7">
542             <title>Date Format Constants (formats include timezone)</title>
544             <tgroup cols="4">
545                 <thead>
546                     <row>
547                         <entry>Constant</entry>
548                         <entry>Description</entry>
549                         <entry>Date</entry>
550                         <entry>Result</entry>
551                     </row>
552                 </thead>
554                 <tbody>
555                     <row>
556                         <entry><constant>Zend_Date::ISO_8601</constant></entry>
558                         <entry>
559                             Date according to <acronym>ISO</acronym> 8601 (string, complete)
560                         </entry>
562                         <entry>2009-02-13T14:53:27+01:00</entry>
563                         <entry><emphasis>2009-02-13T14:53:27+01:00</emphasis></entry>
564                     </row>
566                     <row>
567                         <entry><constant>Zend_Date::RFC_2822</constant></entry>
568                         <entry>Date according to <acronym>RFC</acronym> 2822 (string)</entry>
569                         <entry>2009-02-13T14:53:27+01:00</entry>
570                         <entry><emphasis>Fri, 13 Feb 2009 14:53:27 +0100</emphasis></entry>
571                     </row>
573                     <row>
574                         <entry><constant>Zend_Date::TIMESTAMP</constant></entry>
576                         <entry>
577                             <ulink url="http://en.wikipedia.org/wiki/Unix_Time">Unix time</ulink>
578                             (seconds since 1.1.1970, mixed)
579                         </entry>
581                         <entry>2009-02-13T14:53:27+01:00</entry>
582                         <entry><emphasis>1234533207</emphasis></entry>
583                     </row>
585                     <row>
586                         <entry><constant>Zend_Date::ATOM</constant></entry>
587                         <entry>Date according to <acronym>ATOM</acronym> (string)</entry>
588                         <entry>2009-02-13T14:53:27+01:00</entry>
589                         <entry><emphasis>2009-02-13T14:53:27+01:00</emphasis></entry>
590                     </row>
592                     <row>
593                         <entry><constant>Zend_Date::COOKIE</constant></entry>
594                         <entry>Date for Cookies (string, for Cookies)</entry>
595                         <entry>2009-02-13T14:53:27+01:00</entry>
597                         <entry>
598                             <emphasis><command>Friday, 13-Feb-09 14:53:27
599                                 Europe/Paris</command></emphasis>
600                         </entry>
601                     </row>
603                     <row>
604                         <entry><constant>Zend_Date::RFC_822</constant></entry>
605                         <entry>Date according to <acronym>RFC</acronym> 822 (string)</entry>
606                         <entry>2009-02-13T14:53:27+01:00</entry>
607                         <entry><emphasis>Fri, 13 Feb 09 14:53:27 +0100</emphasis></entry>
608                     </row>
610                     <row>
611                         <entry><constant>Zend_Date::RFC_850</constant></entry>
612                         <entry>Date according to <acronym>RFC</acronym> 850 (string)</entry>
613                         <entry>2009-02-13T14:53:27+01:00</entry>
615                         <entry>
616                             <emphasis><command>Friday, 13-Feb-09 14:53:27
617                                 Europe/Paris</command></emphasis>
618                         </entry>
619                     </row>
621                     <row>
622                         <entry><constant>Zend_Date::RFC_1036</constant></entry>
623                         <entry>Date according to <acronym>RFC</acronym> 1036 (string)</entry>
624                         <entry>2009-02-13T14:53:27+01:00</entry>
625                         <entry><emphasis>Fri, 13 Feb 09 14:53:27 +0100</emphasis></entry>
626                     </row>
628                     <row>
629                         <entry><constant>Zend_Date::RFC_1123</constant></entry>
630                         <entry>Date according to <acronym>RFC</acronym> 1123 (string)</entry>
631                         <entry>2009-02-13T14:53:27+01:00</entry>
632                         <entry><emphasis>Fri, 13 Feb 2009 14:53:27 +0100</emphasis></entry>
633                     </row>
635                     <row>
636                         <entry><constant>Zend_Date::RSS</constant></entry>
637                         <entry>Date for <acronym>RSS</acronym> Feeds (string)</entry>
638                         <entry>2009-02-13T14:53:27+01:00</entry>
639                         <entry><emphasis>Fri, 13 Feb 2009 14:53:27 +0100</emphasis></entry>
640                     </row>
642                     <row>
643                         <entry><constant>Zend_Date::W3C</constant></entry>
645                         <entry>
646                             Date for <acronym>HTML</acronym> or <acronym>HTTP</acronym> according
647                             to <acronym>W3C</acronym> (string)
648                         </entry>
650                         <entry>2009-02-13T14:53:27+01:00</entry>
651                         <entry><emphasis>2009-02-13T14:53:27+01:00</emphasis></entry>
652                     </row>
653                 </tbody>
654             </tgroup>
655         </table>
657         <para>
658             Especially note <constant>Zend_Date::DATES</constant>, since this format specifier has
659             a unique property within <classname>Zend_Date</classname> as an
660             <emphasis>input</emphasis> format specifier. When used as an input format for
661             <varname>$part</varname>, this constant provides the most flexible acceptance of a
662             variety of similar date formats. Heuristics are used to automatically extract dates from
663             an input string and then "fix" simple errors in dates (if any), such as swapping of
664             years, months, and days, when possible.
665         </para>
667         <table id="zend.date.constants.list.table-8">
668             <title>Date and Time Formats (format varies by locale)</title>
670             <tgroup cols="4">
671                 <thead>
672                     <row>
673                         <entry>Constant</entry>
674                         <entry>Description</entry>
675                         <entry>Date</entry>
676                         <entry>Result</entry>
677                     </row>
678                 </thead>
680                 <tbody>
681                     <row>
682                         <entry><constant>Zend_Date::ERA</constant></entry>
683                         <entry>Epoch (string, localized, abbreviated)</entry>
684                         <entry>2009-02-13T14:53:27+01:00</entry>
685                         <entry><emphasis>AD</emphasis> (anno Domini)</entry>
686                     </row>
688                     <row>
689                         <entry><constant>Zend_Date::ERA_NAME</constant></entry>
690                         <entry>Epoch (string, localized, complete)</entry>
691                         <entry>2009-02-13T14:53:27+01:00</entry>
692                         <entry><emphasis>anno domini</emphasis> (anno Domini)</entry>
693                     </row>
695                     <row>
696                         <entry><constant>Zend_Date::DATES</constant></entry>
697                         <entry>Standard date (string, localized, default value).</entry>
698                         <entry>2009-02-13T14:53:27+01:00</entry>
699                         <entry><emphasis>13.02.2009</emphasis></entry>
700                     </row>
702                     <row>
703                         <entry><constant>Zend_Date::DATE_FULL</constant></entry>
704                         <entry>Complete date (string, localized, complete)</entry>
705                         <entry>2009-02-13T14:53:27+01:00</entry>
706                         <entry><emphasis>Friday, 13. February 2009</emphasis></entry>
707                     </row>
709                     <row>
710                         <entry><constant>Zend_Date::DATE_LONG</constant></entry>
711                         <entry>Long date (string, localized, long)</entry>
712                         <entry>2009-02-13T14:53:27+01:00</entry>
713                         <entry><emphasis>13. February 2009</emphasis></entry>
714                     </row>
716                     <row>
717                         <entry><constant>Zend_Date::DATE_MEDIUM</constant></entry>
718                         <entry>Normal date (string, localized, normal)</entry>
719                         <entry>2009-02-13T14:53:27+01:00</entry>
720                         <entry><emphasis>13.02.2009</emphasis></entry>
721                     </row>
723                     <row>
724                         <entry><constant>Zend_Date::DATE_SHORT</constant></entry>
725                         <entry>Abbreviated Date (string, localized, abbreviated)</entry>
726                         <entry>2009-02-13T14:53:27+01:00</entry>
727                         <entry><emphasis>13.02.09</emphasis></entry>
728                     </row>
730                     <row>
731                         <entry><constant>Zend_Date::TIMES</constant></entry>
732                         <entry>Standard time (string, localized, default value)</entry>
733                         <entry>2009-02-13T14:53:27+01:00</entry>
734                         <entry><emphasis>14:53:27</emphasis></entry>
735                     </row>
737                     <row>
738                         <entry><constant>Zend_Date::TIME_FULL</constant></entry>
739                         <entry>Complete time (string, localized, complete)</entry>
740                         <entry>2009-02-13T14:53:27+01:00</entry>
741                         <entry><emphasis><command>14:53 Uhr CET</command></emphasis></entry>
742                     </row>
744                     <row>
745                         <entry><constant>Zend_Date::TIME_LONG</constant></entry>
746                         <entry>Long time (string, localized, Long)</entry>
747                         <entry>2009-02-13T14:53:27+01:00</entry>
748                         <entry><emphasis><command>14:53:27 CET</command></emphasis></entry>
749                     </row>
751                     <row>
752                         <entry><constant>Zend_Date::TIME_MEDIUM</constant></entry>
753                         <entry>Normal time (string, localized, normal)</entry>
754                         <entry>2009-02-13T14:53:27+01:00</entry>
755                         <entry><emphasis>14:53:27</emphasis></entry>
756                     </row>
758                     <row>
759                         <entry><constant>Zend_Date::TIME_SHORT</constant></entry>
760                         <entry>Abbreviated time (string, localized, abbreviated)</entry>
761                         <entry>2009-02-13T14:53:27+01:00</entry>
762                         <entry><emphasis>14:53</emphasis></entry>
763                     </row>
765                     <row>
766                         <entry><constant>Zend_Date::DATETIME</constant></entry>
767                         <entry>Standard date with time (string, localized, default value).</entry>
768                         <entry>2009-02-13T14:53:27+01:00</entry>
769                         <entry><emphasis>13.02.2009 14:53:27</emphasis></entry>
770                     </row>
772                     <row>
773                         <entry><constant>Zend_Date::DATETIME_FULL</constant></entry>
774                         <entry>Complete date with time (string, localized, complete)</entry>
775                         <entry>2009-02-13T14:53:27+01:00</entry>
777                         <entry>
778                             <emphasis><command>Friday, 13. February 2009 14:53 Uhr
779                                 CET</command></emphasis>
780                         </entry>
781                     </row>
783                     <row>
784                         <entry><constant>Zend_Date::DATETIME_LONG</constant></entry>
785                         <entry>Long date with time (string, localized, long)</entry>
786                         <entry>2009-02-13T14:53:27+01:00</entry>
788                         <entry>
789                             <emphasis><command>13. February 2009 14:53:27 CET</command></emphasis>
790                         </entry>
791                     </row>
793                     <row>
794                         <entry><constant>Zend_Date::DATETIME_MEDIUM</constant></entry>
795                         <entry>Normal date with time (string, localized, normal)</entry>
796                         <entry>2009-02-13T14:53:27+01:00</entry>
797                         <entry><emphasis>13.02.2009 14:53:27</emphasis></entry>
798                     </row>
800                     <row>
801                         <entry><constant>Zend_Date::DATETIME_SHORT</constant></entry>
802                         <entry>Abbreviated date with time (string, localized, abbreviated)</entry>
803                         <entry>2009-02-13T14:53:27+01:00</entry>
804                         <entry><emphasis>13.02.09 14:53</emphasis></entry>
805                     </row>
806                 </tbody>
807             </tgroup>
808         </table>
809     </sect2>
811     <sect2 id="zend.date.constants.selfdefinedformats">
812         <title>Self-Defined OUTPUT Formats with ISO</title>
814         <para>
815             If you need a date format not shown above, then use a self-defined format composed from
816             the <acronym>ISO</acronym> format token specifiers below. The following examples
817             illustrate the usage of constants from the table below to create self-defined
818             <acronym>ISO</acronym> formats. The format length is unlimited. Also, multiple usage of
819             format constants is allowed.
820         </para>
822         <para>
823             The accepted format specifiers can be changed from <acronym>ISO</acronym> Format to
824             <acronym>PHP</acronym>'s date format if you are more comfortable with it. However, not
825             all formats defined in the <acronym>ISO</acronym> norm are supported with
826             <acronym>PHP</acronym>'s date format specifiers. Use the
827             <methodname>Zend_Date::setOptions(array('format_type' => 'php'))</methodname> method to
828             switch <classname>Zend_Date</classname> methods from supporting <acronym>ISO</acronym>
829             format specifiers to <acronym>PHP</acronym> <methodname>date()</methodname> type
830             specifiers (see <link linkend="zend.date.constants.phpformats">Self-Defined OUTPUT
831                 Formats Using PHP's date() Format Specifiers</link> below).
832         </para>
834         <example id="zend.date.constants.selfdefinedformats.example-1">
835             <title>Self-Defined ISO Formats</title>
837             <programlisting language="php"><![CDATA[
838 $locale = new Zend_Locale('de_AT');
839 $date = new Zend_Date(1234567890, false, $locale);
840 print $date->toString("'Era:GGGG='GGGG, ' Date:yy.MMMM.dd'yy.MMMM.dd");
841 ]]></programlisting>
842         </example>
844         <table id="zend.date.constants.selfdefinedformats.table">
845             <title>Constants for ISO 8601 Date Output</title>
847             <tgroup cols="4">
848                 <thead>
849                     <row>
850                         <entry>Constant</entry>
851                         <entry>Description</entry>
852                         <entry>Corresponds best to</entry>
853                         <entry>Result</entry>
854                     </row>
855                 </thead>
857                 <tbody>
858                     <row>
859                         <entry>G</entry>
860                         <entry>Epoch, localized, abbreviated</entry>
861                         <entry><constant>Zend_Date::ERA</constant></entry>
862                         <entry><emphasis>AD</emphasis></entry>
863                     </row>
865                     <row>
866                         <entry>GG</entry>
867                         <entry>Epoch, localized, abbreviated</entry>
868                         <entry><constant>Zend_Date::ERA</constant></entry>
869                         <entry><emphasis>AD</emphasis></entry>
870                     </row>
872                     <row>
873                         <entry><constant>GGG</constant></entry>
874                         <entry>Epoch, localized, abbreviated</entry>
875                         <entry><constant>Zend_Date::ERA</constant></entry>
876                         <entry><emphasis>AD</emphasis></entry>
877                     </row>
879                     <row>
880                         <entry><constant>GGGG</constant></entry>
881                         <entry>Epoch, localized, complete</entry>
882                         <entry><constant>Zend_Date::ERA_NAME</constant></entry>
883                         <entry><emphasis>anno domini</emphasis></entry>
884                     </row>
886                     <row>
887                         <entry><constant>GGGGG</constant></entry>
888                         <entry>Epoch, localized, abbreviated</entry>
889                         <entry><constant>Zend_Date::ERA</constant></entry>
890                         <entry><emphasis>a</emphasis></entry>
891                     </row>
893                     <row>
894                         <entry>y</entry>
895                         <entry>Year, at least one digit</entry>
896                         <entry><constant>Zend_Date::YEAR</constant></entry>
897                         <entry><emphasis>9</emphasis></entry>
898                     </row>
900                     <row>
901                         <entry>yy</entry>
902                         <entry>Year, at least two digit</entry>
903                         <entry><constant>Zend_Date::YEAR_SHORT</constant></entry>
904                         <entry><emphasis>09</emphasis></entry>
905                     </row>
907                     <row>
908                         <entry>yyy</entry>
909                         <entry>Year, at least three digit</entry>
910                         <entry><constant>Zend_Date::YEAR</constant></entry>
911                         <entry><emphasis>2009</emphasis></entry>
912                     </row>
914                     <row>
915                         <entry>yyyy</entry>
916                         <entry>Year, at least four digit</entry>
917                         <entry><constant>Zend_Date::YEAR</constant></entry>
918                         <entry><emphasis>2009</emphasis></entry>
919                     </row>
921                     <row>
922                         <entry>yyyyy</entry>
923                         <entry>Year, at least five digit</entry>
924                         <entry><constant>Zend_Date::YEAR</constant></entry>
925                         <entry><emphasis>02009</emphasis></entry>
926                     </row>
928                     <row>
929                         <entry>Y</entry>
931                         <entry>
932                             Year according to <acronym>ISO</acronym> 8601, at least one digit
933                         </entry>
935                         <entry><constant>Zend_Date::YEAR_8601</constant></entry>
936                         <entry><emphasis>9</emphasis></entry>
937                     </row>
939                     <row>
940                         <entry>YY</entry>
942                         <entry>
943                             Year according to <acronym>ISO</acronym> 8601, at least two digit
944                         </entry>
946                         <entry><constant>Zend_Date::YEAR_SHORT_8601</constant></entry>
947                         <entry><emphasis>09</emphasis></entry>
948                     </row>
950                     <row>
951                         <entry><constant>YYY</constant></entry>
953                         <entry>
954                             Year according to <acronym>ISO</acronym> 8601, at least three digit
955                         </entry>
957                         <entry><constant>Zend_Date::YEAR_8601</constant></entry>
958                         <entry><emphasis>2009</emphasis></entry>
959                     </row>
961                     <row>
962                         <entry><constant>YYYY</constant></entry>
964                         <entry>
965                             Year according to <acronym>ISO</acronym> 8601, at least four digit
966                         </entry>
968                         <entry><constant>Zend_Date::YEAR_8601</constant></entry>
969                         <entry><emphasis>2009</emphasis></entry>
970                     </row>
972                     <row>
973                         <entry><constant>YYYYY</constant></entry>
975                         <entry>
976                             Year according to <acronym>ISO</acronym> 8601, at least five digit
977                         </entry>
979                         <entry><constant>Zend_Date::YEAR_8601</constant></entry>
980                         <entry><emphasis>02009</emphasis></entry>
981                     </row>
983                     <row>
984                         <entry>M</entry>
985                         <entry>Month, one or two digit</entry>
986                         <entry><constant>Zend_Date::MONTH_SHORT</constant></entry>
987                         <entry><emphasis>2</emphasis></entry>
988                     </row>
990                     <row>
991                         <entry>MM</entry>
992                         <entry>Month, two digit</entry>
993                         <entry><constant>Zend_Date::MONTH</constant></entry>
994                         <entry><emphasis>02</emphasis></entry>
995                     </row>
997                     <row>
998                         <entry><constant>MMM</constant></entry>
999                         <entry>Month, localized, abbreviated</entry>
1000                         <entry><constant>Zend_Date::MONTH_NAME_SHORT</constant></entry>
1001                         <entry><emphasis>Feb</emphasis></entry>
1002                     </row>
1004                     <row>
1005                         <entry><constant>MMMM</constant></entry>
1006                         <entry>Month, localized, complete</entry>
1007                         <entry><constant>Zend_Date::MONTH_NAME</constant></entry>
1008                         <entry><emphasis>February</emphasis></entry>
1009                     </row>
1011                     <row>
1012                         <entry><constant>MMMMM</constant></entry>
1013                         <entry>Month, localized, abbreviated, one digit</entry>
1014                         <entry><constant>Zend_Date::MONTH_NAME_NARROW</constant></entry>
1015                         <entry><emphasis>F</emphasis></entry>
1016                     </row>
1018                     <row>
1019                         <entry>w</entry>
1020                         <entry>Week, one or two digit</entry>
1021                         <entry><constant>Zend_Date::WEEK</constant></entry>
1022                         <entry><emphasis>5</emphasis></entry>
1023                     </row>
1025                     <row>
1026                         <entry>ww</entry>
1027                         <entry>Week, two digit</entry>
1028                         <entry><constant>Zend_Date::WEEK</constant></entry>
1029                         <entry><emphasis>05</emphasis></entry>
1030                     </row>
1032                     <row>
1033                         <entry>d</entry>
1034                         <entry>Day of the month, one or two digit</entry>
1035                         <entry><constant>Zend_Date::DAY_SHORT</constant></entry>
1036                         <entry><emphasis>9</emphasis></entry>
1037                     </row>
1039                     <row>
1040                         <entry>dd</entry>
1041                         <entry>Day of the month, two digit</entry>
1042                         <entry><constant>Zend_Date::DAY</constant></entry>
1043                         <entry><emphasis>09</emphasis></entry>
1044                     </row>
1046                     <row>
1047                         <entry>D</entry>
1048                         <entry>Day of the year, one, two or three digit</entry>
1049                         <entry><constant>Zend_Date::DAY_OF_YEAR</constant></entry>
1050                         <entry><emphasis>7</emphasis></entry>
1051                     </row>
1053                     <row>
1054                         <entry>DD</entry>
1055                         <entry>Day of the year, two or three digit</entry>
1056                         <entry><constant>Zend_Date::DAY_OF_YEAR</constant></entry>
1057                         <entry><emphasis>07</emphasis></entry>
1058                     </row>
1060                     <row>
1061                         <entry><constant>DDD</constant></entry>
1062                         <entry>Day of the year, three digit</entry>
1063                         <entry><constant>Zend_Date::DAY_OF_YEAR</constant></entry>
1064                         <entry><emphasis>007</emphasis></entry>
1065                     </row>
1067                     <row>
1068                         <entry>E</entry>
1069                         <entry>Day of the week, localized, abbreviated, one char</entry>
1070                         <entry><constant>Zend_Date::WEEKDAY_NARROW</constant></entry>
1071                         <entry><emphasis>M</emphasis></entry>
1072                     </row>
1074                     <row>
1075                         <entry>EE</entry>
1076                         <entry>Day of the week, localized, abbreviated, two or more chars</entry>
1077                         <entry><constant>Zend_Date::WEEKDAY_NAME</constant></entry>
1078                         <entry><emphasis>Mo</emphasis></entry>
1079                     </row>
1081                     <row>
1082                         <entry><constant>EEE</constant></entry>
1083                         <entry>Day of the week, localized, abbreviated, three chars</entry>
1084                         <entry><constant>Zend_Date::WEEKDAY_SHORT</constant></entry>
1085                         <entry><emphasis>Mon</emphasis></entry>
1086                     </row>
1088                     <row>
1089                         <entry><constant>EEEE</constant></entry>
1090                         <entry>Day of the week, localized, complete</entry>
1091                         <entry><constant>Zend_Date::WEEKDAY</constant></entry>
1092                         <entry><emphasis>Monday</emphasis></entry>
1093                     </row>
1095                     <row>
1096                         <entry><constant>EEEEE</constant></entry>
1097                         <entry>Day of the week, localized, abbreviated, one digit</entry>
1098                         <entry><constant>Zend_Date::WEEKDAY_NARROW</constant></entry>
1099                         <entry><emphasis>M</emphasis></entry>
1100                     </row>
1102                     <row>
1103                         <entry>e</entry>
1104                         <entry>Number of the day, one digit</entry>
1105                         <entry><constant>Zend_Date::WEEKDAY_DIGIT</constant></entry>
1106                         <entry><emphasis>4</emphasis></entry>
1107                     </row>
1109                     <row>
1110                         <entry>ee</entry>
1111                         <entry>Number of the day, two digit</entry>
1112                         <entry><constant>Zend_Date::WEEKDAY_NARROW</constant></entry>
1113                         <entry><emphasis>04</emphasis></entry>
1114                     </row>
1116                     <row>
1117                         <entry>a</entry>
1118                         <entry>Time of day, localized</entry>
1119                         <entry><constant>Zend_Date::MERIDIEM</constant></entry>
1120                         <entry><emphasis>vorm.</emphasis></entry>
1121                     </row>
1123                     <row>
1124                         <entry>h</entry>
1125                         <entry>Hour, (1-12), one or two digit</entry>
1126                         <entry><constant>Zend_Date::HOUR_SHORT_AM</constant></entry>
1127                         <entry><emphasis>2</emphasis></entry>
1128                     </row>
1130                     <row>
1131                         <entry>hh</entry>
1132                         <entry>Hour, (01-12), two digit</entry>
1133                         <entry><constant>Zend_Date::HOUR_AM</constant></entry>
1134                         <entry><emphasis>02</emphasis></entry>
1135                     </row>
1137                     <row>
1138                         <entry>H</entry>
1139                         <entry>Hour, (0-23), one or two digit</entry>
1140                         <entry><constant>Zend_Date::HOUR_SHORT</constant></entry>
1141                         <entry><emphasis>2</emphasis></entry>
1142                     </row>
1144                     <row>
1145                         <entry>HH</entry>
1146                         <entry>Hour, (00-23), two digit</entry>
1147                         <entry><constant>Zend_Date::HOUR</constant></entry>
1148                         <entry><emphasis>02</emphasis></entry>
1149                     </row>
1151                     <row>
1152                         <entry>m</entry>
1153                         <entry>Minute, (0-59), one or two digit</entry>
1154                         <entry><constant>Zend_Date::MINUTE_SHORT</constant></entry>
1155                         <entry><emphasis>2</emphasis></entry>
1156                     </row>
1158                     <row>
1159                         <entry>mm</entry>
1160                         <entry>Minute, (00-59), two digit</entry>
1161                         <entry><constant>Zend_Date::MINUTE</constant></entry>
1162                         <entry><emphasis>02</emphasis></entry>
1163                     </row>
1165                     <row>
1166                         <entry>s</entry>
1167                         <entry>Second, (0-59), one or two digit</entry>
1168                         <entry><constant>Zend_Date::SECOND_SHORT</constant></entry>
1169                         <entry><emphasis>2</emphasis></entry>
1170                     </row>
1172                     <row>
1173                         <entry>ss</entry>
1174                         <entry>Second, (00-59), two digit</entry>
1175                         <entry><constant>Zend_Date::SECOND</constant></entry>
1176                         <entry><emphasis>02</emphasis></entry>
1177                     </row>
1179                     <row>
1180                         <entry>S</entry>
1181                         <entry>Millisecond</entry>
1182                         <entry><constant>Zend_Date::MILLISECOND</constant></entry>
1183                         <entry><emphasis>20536</emphasis></entry>
1184                     </row>
1186                     <row>
1187                         <entry>z</entry>
1188                         <entry>Time zone, localized, abbreviated</entry>
1189                         <entry><constant>Zend_Date::TIMEZONE</constant></entry>
1190                         <entry><emphasis><constant>CET</constant></emphasis></entry>
1191                     </row>
1193                     <row>
1194                         <entry>zz</entry>
1195                         <entry>Time zone, localized, abbreviated</entry>
1196                         <entry><constant>Zend_Date::TIMEZONE</constant></entry>
1197                         <entry><emphasis><constant>CET</constant></emphasis></entry>
1198                     </row>
1200                     <row>
1201                         <entry>zzz</entry>
1202                         <entry>Time zone, localized, abbreviated</entry>
1203                         <entry><constant>Zend_Date::TIMEZONE</constant></entry>
1204                         <entry><emphasis><constant>CET</constant></emphasis></entry>
1205                     </row>
1207                     <row>
1208                         <entry>zzzz</entry>
1209                         <entry>Time zone, localized, complete</entry>
1210                         <entry><constant>Zend_Date::TIMEZONE_NAME</constant></entry>
1211                         <entry><emphasis><command>Europe/Paris</command></emphasis></entry>
1212                     </row>
1214                     <row>
1215                         <entry>Z</entry>
1216                         <entry>Difference of time zone</entry>
1217                         <entry><constant>Zend_Date::GMT_DIFF</constant></entry>
1218                         <entry><emphasis>+0100</emphasis></entry>
1219                     </row>
1221                     <row>
1222                         <entry>ZZ</entry>
1223                         <entry>Difference of time zone</entry>
1224                         <entry><constant>Zend_Date::GMT_DIFF</constant></entry>
1225                         <entry><emphasis>+0100</emphasis></entry>
1226                     </row>
1228                     <row>
1229                         <entry><constant>ZZZ</constant></entry>
1230                         <entry>Difference of time zone</entry>
1231                         <entry><constant>Zend_Date::GMT_DIFF</constant></entry>
1232                         <entry><emphasis>+0100</emphasis></entry>
1233                     </row>
1235                     <row>
1236                         <entry><constant>ZZZZ</constant></entry>
1237                         <entry>Difference of time zone, separated</entry>
1238                         <entry><constant>Zend_Date::GMT_DIFF_SEP</constant></entry>
1239                         <entry><emphasis>+01:00</emphasis></entry>
1240                     </row>
1242                     <row>
1243                         <entry>A</entry>
1244                         <entry>Milliseconds from the actual day</entry>
1245                         <entry><constant>Zend_Date::MILLISECOND</constant></entry>
1246                         <entry><emphasis>20563</emphasis></entry>
1247                     </row>
1248                 </tbody>
1249             </tgroup>
1250         </table>
1252         <note>
1253             <para>
1254                 Note that the default <acronym>ISO</acronym> format differs from
1255                 <acronym>PHP</acronym>'s format which can be irritating if you have not used in
1256                 previous. Especially the format specifiers for <emphasis>Year and Minute</emphasis>
1257                 are often not used in the intended way.
1258             </para>
1260             <para>
1261                 For <emphasis>year</emphasis> there are two specifiers available
1262                 which are often mistaken. The <emphasis>Y</emphasis> specifier
1263                 for the <acronym>ISO</acronym> year and the <emphasis>y</emphasis> specifier for the
1264                 real year. The difference is small but significant.
1265                 <emphasis>Y</emphasis> calculates the <acronym>ISO</acronym> year, which is often
1266                 used for calendar formats. See for example the 31. December 2007. The real year is
1267                 2007, but it is the first day of the first week in the week 1 of the year 2008.
1268                 So, if you are using '<command>dd.MM.yyyy</command>' you will get
1269                 '<command>31.December.2007</command>' but if you use '<command>dd.MM.YYYY</command>'
1270                 you will get '<command>31.December.2008</command>'. As you see this is no bug but a
1271                 expected behaviour depending on the used specifiers.
1272             </para>
1274             <para>
1275                 For <emphasis>minute</emphasis> the difference is not so big. <acronym>ISO</acronym>
1276                 uses the specifier <emphasis>m</emphasis> for the minute, unlike
1277                 <acronym>PHP</acronym> which uses <emphasis>i</emphasis>. So if you are getting no
1278                 minute in your format check if you have used the right specifier.
1279             </para>
1280         </note>
1281     </sect2>
1283     <sect2 id="zend.date.constants.phpformats">
1284         <title>Self-Defined OUTPUT Formats Using PHP's date() Format Specifiers</title>
1286         <para>
1287             If you are more comfortable with <acronym>PHP</acronym>'s date format specifier than
1288             with <acronym>ISO</acronym> format specifiers, then you can use the
1289             <methodname>Zend_Date::setOptions(array('format_type' => 'php'))</methodname> method to
1290             switch <classname>Zend_Date</classname> methods from supporting <acronym>ISO</acronym>
1291             format specifiers to <acronym>PHP</acronym> <methodname>date()</methodname> type
1292             specifiers. Afterwards, all format parameters must be given with <ulink
1293                 url="http://php.net/date">PHP's <methodname>date()</methodname> format
1294                 specifiers</ulink>. The <acronym>PHP</acronym> date format lacks some of the formats
1295             supported by the <acronym>ISO</acronym> Format, and vice-versa. If you are not already
1296             comfortable with it, then use the standard <acronym>ISO</acronym> format instead. Also,
1297             if you have legacy code using <acronym>PHP</acronym>'s date format, then either manually
1298             convert it to the <acronym>ISO</acronym> format using <link
1299                 linkend="zend.locale.date.normalize">Zend_Locale_Format::convertPhpToIsoFormat()</link>,
1300             or use <methodname>setOptions()</methodname>. The following examples illustrate the
1301             usage of constants from the table below to create self-defined formats.
1302         </para>
1304         <example id="zend.date.constants.phpformats.example-1">
1305             <title>Self-Defined Formats with PHP Specifier</title>
1307             <programlisting language="php"><![CDATA[
1308 $locale = new Zend_Locale('de_AT');
1309 Zend_Date::setOptions(array('format_type' => 'php'));
1310 $date = new Zend_Date(1234567890, false, $locale);
1312 // outputs something like 'February 16, 2007, 3:36 am'
1313 print $date->toString('F j, Y, g:i a');
1315 print $date->toString("'Format:D M j G:i:s T Y='D M j G:i:s T Y");
1316 ]]></programlisting>
1317         </example>
1319         <important>
1320             <title>PHP Date format and using constants</title>
1322             <para>
1323                 It is important to note that <classname>Zend_Date</classname>'s constants are
1324                 using the <acronym>ISO</acronym> notation. This means, that when you set
1325                 <classname>Zend_Date</classname> to use the <acronym>PHP</acronym> notation,
1326                 you should not use <classname>Zend_Date</classname>'s constants, but define the
1327                 wished format manually. If you don't follow this recommendation, you can get
1328                 unexpected results.
1329             </para>
1330         </important>
1332         <para>
1333             The following table shows the list of <acronym>PHP</acronym> date format specifiers with
1334             their equivalent <classname>Zend_Date</classname> constants and
1335             <acronym>CLDR</acronym> and <acronym>ISO</acronym> equivalent format specifiers. In most
1336             cases, when the <acronym>CLDR</acronym> and <acronym>ISO</acronym> format does not have
1337             an equivalent format specifier, the <acronym>PHP</acronym> format specifier is not
1338             altered by <methodname>Zend_Locale_Format::convertPhpToIsoFormat()</methodname>, and the
1339             <classname>Zend_Date</classname> methods then recognize these "peculiar"
1340             <acronym>PHP</acronym> format specifiers, even when in the default
1341             "<acronym>ISO</acronym>" format mode.
1342         </para>
1344         <table id="zend.date.constants.phpformats.table">
1345             <title>Constants for PHP Date Output</title>
1347             <tgroup cols="5">
1348                 <thead>
1349                     <row>
1350                         <entry>Constant</entry>
1351                         <entry>Description</entry>
1352                         <entry>Corresponds best to</entry>
1353                         <entry>closest <acronym>CLDR</acronym> equivalent</entry>
1354                         <entry>Result</entry>
1355                     </row>
1356                 </thead>
1358                 <tbody>
1359                     <row>
1360                         <entry>d</entry>
1361                         <entry>Day of the month, two digit</entry>
1362                         <entry><constant>Zend_Date::DAY</constant></entry>
1363                         <entry>dd</entry>
1364                         <entry><emphasis>09</emphasis></entry>
1365                     </row>
1367                     <row>
1368                         <entry>D</entry>
1369                         <entry>Day of the week, localized, abbreviated, three digit</entry>
1370                         <entry><constant>Zend_Date::WEEKDAY_SHORT</constant></entry>
1371                         <entry><constant>EEE</constant></entry>
1372                         <entry><emphasis>Mon</emphasis></entry>
1373                     </row>
1375                     <row>
1376                         <entry>j</entry>
1377                         <entry>Day of the month, one or two digit</entry>
1378                         <entry><constant>Zend_Date::DAY_SHORT</constant></entry>
1379                         <entry>d</entry>
1380                         <entry><emphasis>9</emphasis></entry>
1381                     </row>
1383                     <row>
1384                         <entry>l (lowercase L)</entry>
1385                         <entry>Day of the week, localized, complete</entry>
1386                         <entry><constant>Zend_Date::WEEKDAY</constant></entry>
1387                         <entry><constant>EEEE</constant></entry>
1388                         <entry><emphasis>Monday</emphasis></entry>
1389                     </row>
1391                     <row>
1392                         <entry>N</entry>
1393                         <entry>Number of the weekday, one digit</entry>
1394                         <entry><constant>Zend_Date::WEEKDAY_8601</constant></entry>
1395                         <entry>e</entry>
1396                         <entry><emphasis>4</emphasis></entry>
1397                     </row>
1399                     <row>
1400                         <entry>S</entry>
1401                         <entry>English suffixes for day of month, two chars</entry>
1402                         <entry>no equivalent</entry>
1403                         <entry>no equivalent</entry>
1404                         <entry><emphasis>st</emphasis></entry>
1405                     </row>
1407                     <row>
1408                         <entry>w</entry>
1409                         <entry>Number of the weekday, 0=sunday, 6=saturday</entry>
1410                         <entry><constant>Zend_Date::WEEKDAY_DIGIT</constant></entry>
1411                         <entry>no equivalent</entry>
1412                         <entry><emphasis>4</emphasis></entry>
1413                     </row>
1415                     <row>
1416                         <entry>z</entry>
1417                         <entry>Day of the year, one, two or three digit</entry>
1418                         <entry><constant>Zend_Date::DAY_OF_YEAR</constant></entry>
1419                         <entry>D</entry>
1420                         <entry><emphasis>7</emphasis></entry>
1421                     </row>
1423                     <row>
1424                         <entry>W</entry>
1425                         <entry>Week, one or two digit</entry>
1426                         <entry><constant>Zend_Date::WEEK</constant></entry>
1427                         <entry>w</entry>
1428                         <entry><emphasis>5</emphasis></entry>
1429                     </row>
1431                     <row>
1432                         <entry>F</entry>
1433                         <entry>Month, localized, complete</entry>
1434                         <entry><constant>Zend_Date::MONTH_NAME</constant></entry>
1435                         <entry><constant>MMMM</constant></entry>
1436                         <entry><emphasis>February</emphasis></entry>
1437                     </row>
1439                     <row>
1440                         <entry>m</entry>
1441                         <entry>Month, two digit</entry>
1442                         <entry><constant>Zend_Date::MONTH</constant></entry>
1443                         <entry>MM</entry>
1444                         <entry><emphasis>02</emphasis></entry>
1445                     </row>
1447                     <row>
1448                         <entry>M</entry>
1449                         <entry>Month, localized, abbreviated</entry>
1450                         <entry><constant>Zend_Date::MONTH_NAME_SHORT</constant></entry>
1451                         <entry><constant>MMM</constant></entry>
1452                         <entry><emphasis>Feb</emphasis></entry>
1453                     </row>
1455                     <row>
1456                         <entry>n</entry>
1457                         <entry>Month, one or two digit</entry>
1458                         <entry><constant>Zend_Date::MONTH_SHORT</constant></entry>
1459                         <entry>M</entry>
1460                         <entry><emphasis>2</emphasis></entry>
1461                     </row>
1463                     <row>
1464                         <entry>t</entry>
1465                         <entry>Number of days per month, one or two digits</entry>
1466                         <entry><constant>Zend_Date::MONTH_DAYS</constant></entry>
1467                         <entry>no equivalent</entry>
1468                         <entry><emphasis>30</emphasis></entry>
1469                     </row>
1471                     <row>
1472                         <entry>L</entry>
1473                         <entry>Leapyear, boolean</entry>
1474                         <entry><constant>Zend_Date::LEAPYEAR</constant></entry>
1475                         <entry>no equivalent</entry>
1476                         <entry><emphasis><constant>TRUE</constant></emphasis></entry>
1477                     </row>
1479                     <row>
1480                         <entry>o</entry>
1482                         <entry>
1483                             Year according to <acronym>ISO</acronym> 8601, at least four digit
1484                         </entry>
1486                         <entry><constant>Zend_Date::YEAR_8601</constant></entry>
1487                         <entry><constant>YYYY</constant></entry>
1488                         <entry><emphasis>2009</emphasis></entry>
1489                     </row>
1491                     <row>
1492                         <entry>Y</entry>
1493                         <entry>Year, at least four digit</entry>
1494                         <entry><constant>Zend_Date::YEAR</constant></entry>
1495                         <entry>yyyy</entry>
1496                         <entry><emphasis>2009</emphasis></entry>
1497                     </row>
1499                     <row>
1500                         <entry>y</entry>
1501                         <entry>Year, at least two digit</entry>
1502                         <entry><constant>Zend_Date::YEAR_SHORT</constant></entry>
1503                         <entry>yy</entry>
1504                         <entry><emphasis>09</emphasis></entry>
1505                     </row>
1507                     <row>
1508                         <entry>a</entry>
1509                         <entry>Time of day, localized</entry>
1510                         <entry><constant>Zend_Date::MERIDIEM</constant></entry>
1511                         <entry>a (sort of, but likely to be uppercase)</entry>
1512                         <entry><emphasis>vorm.</emphasis></entry>
1513                     </row>
1515                     <row>
1516                         <entry>A</entry>
1517                         <entry>Time of day, localized</entry>
1518                         <entry><constant>Zend_Date::MERIDIEM</constant></entry>
1519                         <entry>a (sort of, but no guarantee that the format is uppercase)</entry>
1520                         <entry><emphasis><command>VORM.</command></emphasis></entry>
1521                     </row>
1523                     <row>
1524                         <entry>B</entry>
1525                         <entry>Swatch internet time</entry>
1526                         <entry><constant>Zend_Date::SWATCH</constant></entry>
1527                         <entry>no equivalent</entry>
1528                         <entry><emphasis>1463</emphasis></entry>
1529                     </row>
1531                     <row>
1532                         <entry>g</entry>
1533                         <entry>Hour, (1-12), one or two digit</entry>
1534                         <entry><constant>Zend_Date::HOUR_SHORT_AM</constant></entry>
1535                         <entry>h</entry>
1536                         <entry><emphasis>2</emphasis></entry>
1537                     </row>
1539                     <row>
1540                         <entry>G</entry>
1541                         <entry>Hour, (0-23), one or two digit</entry>
1542                         <entry><constant>Zend_Date::HOUR_SHORT</constant></entry>
1543                         <entry>H</entry>
1544                         <entry><emphasis>2</emphasis></entry>
1545                     </row>
1547                     <row>
1548                         <entry>h</entry>
1549                         <entry>Hour, (01-12), two digit</entry>
1550                         <entry><constant>Zend_Date::HOUR_AM</constant></entry>
1551                         <entry>hh</entry>
1552                         <entry><emphasis>02</emphasis></entry>
1553                     </row>
1555                     <row>
1556                         <entry>H</entry>
1557                         <entry>Hour, (00-23), two digit</entry>
1558                         <entry><constant>Zend_Date::HOUR</constant></entry>
1559                         <entry>HH</entry>
1560                         <entry><emphasis>02</emphasis></entry>
1561                     </row>
1563                     <row>
1564                         <entry>i</entry>
1565                         <entry>Minute, (00-59), two digit</entry>
1566                         <entry><constant>Zend_Date::MINUTE</constant></entry>
1567                         <entry>mm</entry>
1568                         <entry><emphasis>02</emphasis></entry>
1569                     </row>
1571                     <row>
1572                         <entry>s</entry>
1573                         <entry>Second, (00-59), two digit</entry>
1574                         <entry><constant>Zend_Date::SECOND</constant></entry>
1575                         <entry>ss</entry>
1576                         <entry><emphasis>02</emphasis></entry>
1577                     </row>
1579                     <row>
1580                         <entry>e</entry>
1581                         <entry>Time zone, localized, complete</entry>
1582                         <entry><constant>Zend_Date::TIMEZONE_NAME</constant></entry>
1583                         <entry>zzzz</entry>
1584                         <entry><emphasis><command>Europe/Paris</command></emphasis></entry>
1585                     </row>
1587                     <row>
1588                         <entry>I</entry>
1589                         <entry>Daylight</entry>
1590                         <entry><constant>Zend_Date::DAYLIGHT</constant></entry>
1591                         <entry>no equivalent</entry>
1592                         <entry><emphasis>1</emphasis></entry>
1593                     </row>
1595                     <row>
1596                         <entry>O</entry>
1597                         <entry>Difference of time zone</entry>
1598                         <entry><constant>Zend_Date::GMT_DIFF</constant></entry>
1599                         <entry>Z or ZZ or <constant>ZZZ</constant></entry>
1600                         <entry><emphasis>+0100</emphasis></entry>
1601                     </row>
1603                     <row>
1604                         <entry>P</entry>
1605                         <entry>Difference of time zone, separated</entry>
1606                         <entry><constant>Zend_Date::GMT_DIFF_SEP</constant></entry>
1607                         <entry><constant>ZZZZ</constant></entry>
1608                         <entry><emphasis>+01:00</emphasis></entry>
1609                     </row>
1611                     <row>
1612                         <entry>T</entry>
1613                         <entry>Time zone, localized, abbreviated</entry>
1614                         <entry><constant>Zend_Date::TIMEZONE</constant></entry>
1615                         <entry>z or zz or zzz</entry>
1616                         <entry><emphasis><constant>CET</constant></emphasis></entry>
1617                     </row>
1619                     <row>
1620                         <entry>Z</entry>
1621                         <entry>Time zone offset in seconds</entry>
1622                         <entry><constant>Zend_Date::TIMEZONE_SECS</constant></entry>
1623                         <entry>no equivalent</entry>
1624                         <entry><emphasis>3600</emphasis></entry>
1625                     </row>
1627                     <row>
1628                         <entry>c</entry>
1629                         <entry>Standard Iso format output</entry>
1630                         <entry><constant>Zend_Date::ISO_8601</constant></entry>
1631                         <entry>no equivalent</entry>
1632                         <entry><emphasis>2004-02-13T15:19:21+00:00</emphasis></entry>
1633                     </row>
1635                     <row>
1636                         <entry>r</entry>
1637                         <entry>Standard Rfc 2822 format output</entry>
1638                         <entry><constant>Zend_Date::RFC_2822</constant></entry>
1639                         <entry>no equivalent</entry>
1640                         <entry><emphasis>Thu, 21 Dec 2000 16:01:07 +0200</emphasis></entry>
1641                     </row>
1643                     <row>
1644                         <entry>U</entry>
1645                         <entry>Unix timestamp</entry>
1646                         <entry><constant>Zend_Date::TIMESTAMP</constant></entry>
1647                         <entry>no equivalent</entry>
1648                         <entry><emphasis>15275422364</emphasis></entry>
1649                     </row>
1650                 </tbody>
1651             </tgroup>
1652         </table>
1653     </sect2>
1654 </sect1>