Zend_Date-Constants.xml 75 KB

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