Zend_Date-Constants.xml 75 KB

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