Zend_Date-Constants.xml 73 KB

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