date_helper.html 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Date Helper &mdash; CodeIgniter 3.1.11 documentation</title>
  8. <link rel="shortcut icon" href="../_static/ci-icon.ico"/>
  9. <link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
  10. <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" />
  11. <link rel="index" title="Index"
  12. href="../genindex.html"/>
  13. <link rel="search" title="Search" href="../search.html"/>
  14. <link rel="top" title="CodeIgniter 3.1.11 documentation" href="../index.html"/>
  15. <link rel="up" title="Helpers" href="index.html"/>
  16. <link rel="next" title="Directory Helper" href="directory_helper.html"/>
  17. <link rel="prev" title="Cookie Helper" href="cookie_helper.html"/>
  18. <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
  19. </head>
  20. <body class="wy-body-for-nav" role="document">
  21. <div id="nav">
  22. <div id="nav_inner">
  23. <div id="pulldown-menu" class="ciNav">
  24. <ul>
  25. <li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
  26. </ul>
  27. <ul>
  28. <li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
  29. <li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
  30. <li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
  31. <li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
  32. <li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
  33. </ul>
  34. </li>
  35. </ul>
  36. <ul>
  37. <li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
  38. <li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
  39. <li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
  40. <li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
  41. <li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
  42. <li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
  43. <li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
  44. </ul>
  45. </li>
  46. </ul>
  47. <ul>
  48. <li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
  49. <li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
  50. <li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
  51. <li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
  52. <li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
  53. </ul>
  54. </li>
  55. </ul>
  56. <ul>
  57. <li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
  58. <li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
  59. <li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
  60. </ul>
  61. </li>
  62. </ul>
  63. <ul>
  64. <li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
  65. <li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
  66. <li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
  67. <li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
  68. <li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
  69. <li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
  70. <li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
  71. <li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
  72. <li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
  73. <li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
  74. <li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
  75. <li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
  76. <li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
  77. <li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
  78. <li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
  79. <li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
  80. <li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
  81. <li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
  82. <li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
  83. <li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
  84. <li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
  85. <li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
  86. <li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
  87. <li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
  88. <li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
  89. <li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
  90. <li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
  91. </ul>
  92. </li>
  93. </ul>
  94. <ul>
  95. <li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul>
  96. <li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li>
  97. <li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li>
  98. <li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li>
  99. <li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li>
  100. <li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li>
  101. <li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li>
  102. <li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li>
  103. <li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li>
  104. <li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li>
  105. <li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li>
  106. <li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li>
  107. <li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li>
  108. <li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li>
  109. <li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li>
  110. <li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li>
  111. <li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li>
  112. <li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li>
  113. <li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li>
  114. <li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li>
  115. <li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li>
  116. <li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li>
  117. <li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li>
  118. <li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li>
  119. <li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li>
  120. <li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li>
  121. <li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li>
  122. <li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li>
  123. <li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li>
  124. <li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
  125. <li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li>
  126. </ul>
  127. </li>
  128. </ul>
  129. <ul>
  130. <li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
  131. <li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
  132. <li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
  133. <li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
  134. <li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
  135. <li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
  136. <li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
  137. <li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
  138. <li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
  139. <li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
  140. <li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
  141. <li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
  142. <li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
  143. <li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
  144. <li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
  145. </ul>
  146. </li>
  147. </ul>
  148. <ul class="current">
  149. <li class="toctree-l1 current"><a class="reference internal" href="index.html">Helpers</a><ul class="current">
  150. <li class="toctree-l2"><a class="reference internal" href="array_helper.html">Array Helper</a></li>
  151. <li class="toctree-l2"><a class="reference internal" href="captcha_helper.html">CAPTCHA Helper</a></li>
  152. <li class="toctree-l2"><a class="reference internal" href="cookie_helper.html">Cookie Helper</a></li>
  153. <li class="toctree-l2 current"><a class="current reference internal" href="#">Date Helper</a></li>
  154. <li class="toctree-l2"><a class="reference internal" href="directory_helper.html">Directory Helper</a></li>
  155. <li class="toctree-l2"><a class="reference internal" href="download_helper.html">Download Helper</a></li>
  156. <li class="toctree-l2"><a class="reference internal" href="email_helper.html">Email Helper</a></li>
  157. <li class="toctree-l2"><a class="reference internal" href="file_helper.html">File Helper</a></li>
  158. <li class="toctree-l2"><a class="reference internal" href="form_helper.html">Form Helper</a></li>
  159. <li class="toctree-l2"><a class="reference internal" href="html_helper.html">HTML Helper</a></li>
  160. <li class="toctree-l2"><a class="reference internal" href="inflector_helper.html">Inflector Helper</a></li>
  161. <li class="toctree-l2"><a class="reference internal" href="language_helper.html">Language Helper</a></li>
  162. <li class="toctree-l2"><a class="reference internal" href="number_helper.html">Number Helper</a></li>
  163. <li class="toctree-l2"><a class="reference internal" href="path_helper.html">Path Helper</a></li>
  164. <li class="toctree-l2"><a class="reference internal" href="security_helper.html">Security Helper</a></li>
  165. <li class="toctree-l2"><a class="reference internal" href="smiley_helper.html">Smiley Helper</a></li>
  166. <li class="toctree-l2"><a class="reference internal" href="string_helper.html">String Helper</a></li>
  167. <li class="toctree-l2"><a class="reference internal" href="text_helper.html">Text Helper</a></li>
  168. <li class="toctree-l2"><a class="reference internal" href="typography_helper.html">Typography Helper</a></li>
  169. <li class="toctree-l2"><a class="reference internal" href="url_helper.html">URL Helper</a></li>
  170. <li class="toctree-l2"><a class="reference internal" href="xml_helper.html">XML Helper</a></li>
  171. </ul>
  172. </li>
  173. </ul>
  174. </div>
  175. </div>
  176. </div>
  177. <div id="nav2">
  178. <a href="#" id="openToc">
  179. <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKwCaAwERAAIRAQMRAf/EAHsAAQAABwEBAAAAAAAAAAAAAAABAwQFBgcIAgkBAQAAAAAAAAAAAAAAAAAAAAAQAAEDAwICBwYEAgsAAAAAAAIBAwQAEQUSBiEHkROTVNQWGDFBUVIUCHEiMtOUFWGBobHRQlMkZIRVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDSC+ygkOOaUoKigUCgUCgUCgUCgUCgUCgUCgkuGguIP9FBMFb0Hqg7We+3jlmIqqYFf4ub+/QYlnOR/LqIBKGFUbf8qWv971BytQXXE7Y3Lnm3HsFhp2TaZJAdchRXpIgSpdEJWxJEW3xoKV7F5OMy7JkQn2o7D6w33XGjEAkoiqrJEqIiOIiKuhePCgqp22dyYyS3CyWHnQ5joG61HkRnmnTbaFSMhExRVQRRVJU9iUHjE7ez+fJ0MFipmUNhBV8YUd2SoIV9KkjQla9ltegttBdPLW4/qocL+UTfrMiHW4+P9M71shuyrqaHTcxsl7jegpsji8nh5ZwMvDfgTm0RTjSmjYdFCS6KoOIipdFunCgmNYTMv457MMY6U7iI6oMieDDhRm1VbIhuoOkbqtuK0Hpzb+eZcYZexUxt6UyUqK2cd0SdjtgrhOgijcgERUlJOCIl6CpgbP3blRI8XgMjNARAyKNDfeRBdFDBVUAXgQrqH4pxoJTu2NysY97LP4ac1io5q1InHFeGO24LnVKJuKOkSQ/yKir+rh7aCLG1dzypZQI2FnvTgccYOM3FeN0XWERXAUEFVQgQkUktdLpegm+Td3/Xli/L+S/mYNJIOF9G/wBeLKrZHFb0akG6W1WtQWSg3Dyg5e7V3fipE3O4/wCrktyzYA+ufas2LbZIlmnAT2kvuoN1wft95augilglX/tzP3qCu9O3LL/wV/i5v79BvmTADq14UGu91467Z6U9y0HzH/ncj/U/sT/CgynZG7I2NezpZGUjIycJkYkZSG+uQ81pbBNKLxJfjwoMqZ3/ALYHl35AJ7/cuwHcu5k7r1Q5pHetBjquqVVJWGxj9Zrtcl/Ggy3dHMvauR3HFZj5nHNxSyW5JISYDMoIwx8tFIGHZhPNaykGapr6rUAiicEoMG21lMRj8buPAz8xhJrr7uOeiPTCyAwXUaGR1mgozbTusOsFLEiJ7fbQa/h7gcjy2H3V6xppwDNtUSxCJIqp7valBuWVzJ22xuCROXNNZiJkMtms0DbjUkAZjzoDrTMd9dDRI44ZC2YsrYdKWP2WDT2S3N9dNdlRYrGMYc06IURXSYb0igrpWS485xVNS6nF4rwslkoMwnbpgZLB7bmt5uMweAhDEl4B5uSLzzqTnnyVpW2jaJHRMSIjdDiiotvy3DOE5rYTEbkl5yFn28k7JyG4c7AU2HtLH1uKfaiMPI40CdYbpNtmLdwTSn5rewLNld+7TLdeal4WarWBkbVKBjgdElMJJwAAY5fl4kB3b1fp4XvagsGS3FjJfLzDNtS8aeXx7LzT7TyzByQE5PccRGRC0ZRUDRV6y62vbjagzLmJzS2vuPK43JY6aP1TW6Jz+RIWyFtyC06y3EkiiinAo7YCqfq1AqqnGgsOH3lhZO8d1pmcpB8j5XIm9OYlBJSQ/FSS4427DKO0RC8AlcEMhFdViRR1WDWR5t3WXVuL1d106kG9vdeye2g60+1FDyW0shIcXVpyroXt8I8dfd+NB1vioAdWnD3UF1+gD4UFc6CEKpagxXN43rwJLUHz7yX2c8zokt9uHlsPIhA4aRnnHJTLptIS6CNsY7iASpxUUMkReGpfbQW0vtN5pitvrsN28rwtBD0nc0+/Yft5XhaB6TuaXfsP28rwtA9J3NPv2H7eV4Wgek7mn37D9vK8LQPSdzT79h+3leFoHpO5pd+w/byvC0D0nc0u/Yft5XhaB6TuaXfsP28rwtA9J3NLv2H7eV4Wgek7ml37D9vK8LQPSdzS79h+3leFoHpO5p9+w/byvC0E9r7Reazy2HIYVPxkS/CUHVn26cosxyv2g7h89LYmZSXOenvLEQ1YaQ222RATcQCP8rSGqqA8S02W2pQ6FhMoAIlqCtsnwoCpdKClejI4i3Sgtb+GBxVuNBSFt1pV/RQefLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8utJ/koJ7WCbBU/LQXOPAFq1koK8B0pag90CggtBBf6qB0UDooHRQOigdFA6KB0UDooHRQOigdFA6KB0UDooI0EaBQf//Z" title="Toggle Table of Contents" alt="Toggle Table of Contents" />
  180. </a>
  181. </div>
  182. <div class="wy-grid-for-nav">
  183. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  184. <div class="wy-side-nav-search">
  185. <a href="../index.html" class="fa fa-home"> CodeIgniter</a>
  186. <div role="search">
  187. <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
  188. <input type="text" name="q" placeholder="Search docs" />
  189. <input type="hidden" name="check_keywords" value="yes" />
  190. <input type="hidden" name="area" value="default" />
  191. </form>
  192. </div>
  193. </div>
  194. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  195. <ul>
  196. <li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
  197. </ul>
  198. <ul>
  199. <li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
  200. <li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
  201. <li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
  202. <li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
  203. <li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
  204. </ul>
  205. </li>
  206. </ul>
  207. <ul>
  208. <li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
  209. <li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
  210. <li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
  211. <li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
  212. <li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
  213. <li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
  214. <li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
  215. </ul>
  216. </li>
  217. </ul>
  218. <ul>
  219. <li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
  220. <li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
  221. <li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
  222. <li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
  223. <li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
  224. </ul>
  225. </li>
  226. </ul>
  227. <ul>
  228. <li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
  229. <li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
  230. <li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
  231. </ul>
  232. </li>
  233. </ul>
  234. <ul>
  235. <li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
  236. <li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
  237. <li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
  238. <li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
  239. <li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
  240. <li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
  241. <li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
  242. <li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
  243. <li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
  244. <li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
  245. <li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
  246. <li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
  247. <li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
  248. <li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
  249. <li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
  250. <li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
  251. <li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
  252. <li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
  253. <li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
  254. <li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
  255. <li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
  256. <li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
  257. <li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
  258. <li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
  259. <li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
  260. <li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
  261. <li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
  262. </ul>
  263. </li>
  264. </ul>
  265. <ul>
  266. <li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Libraries</a><ul>
  267. <li class="toctree-l2"><a class="reference internal" href="../libraries/benchmark.html">Benchmarking Class</a></li>
  268. <li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li>
  269. <li class="toctree-l2"><a class="reference internal" href="../libraries/calendar.html">Calendaring Class</a></li>
  270. <li class="toctree-l2"><a class="reference internal" href="../libraries/cart.html">Shopping Cart Class</a></li>
  271. <li class="toctree-l2"><a class="reference internal" href="../libraries/config.html">Config Class</a></li>
  272. <li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li>
  273. <li class="toctree-l2"><a class="reference internal" href="../libraries/encrypt.html">Encrypt Class</a></li>
  274. <li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Library</a></li>
  275. <li class="toctree-l2"><a class="reference internal" href="../libraries/file_uploading.html">File Uploading Class</a></li>
  276. <li class="toctree-l2"><a class="reference internal" href="../libraries/form_validation.html">Form Validation</a></li>
  277. <li class="toctree-l2"><a class="reference internal" href="../libraries/ftp.html">FTP Class</a></li>
  278. <li class="toctree-l2"><a class="reference internal" href="../libraries/image_lib.html">Image Manipulation Class</a></li>
  279. <li class="toctree-l2"><a class="reference internal" href="../libraries/input.html">Input Class</a></li>
  280. <li class="toctree-l2"><a class="reference internal" href="../libraries/javascript.html">Javascript Class</a></li>
  281. <li class="toctree-l2"><a class="reference internal" href="../libraries/language.html">Language Class</a></li>
  282. <li class="toctree-l2"><a class="reference internal" href="../libraries/loader.html">Loader Class</a></li>
  283. <li class="toctree-l2"><a class="reference internal" href="../libraries/migration.html">Migrations Class</a></li>
  284. <li class="toctree-l2"><a class="reference internal" href="../libraries/output.html">Output Class</a></li>
  285. <li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination Class</a></li>
  286. <li class="toctree-l2"><a class="reference internal" href="../libraries/parser.html">Template Parser Class</a></li>
  287. <li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security Class</a></li>
  288. <li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li>
  289. <li class="toctree-l2"><a class="reference internal" href="../libraries/table.html">HTML Table Class</a></li>
  290. <li class="toctree-l2"><a class="reference internal" href="../libraries/trackback.html">Trackback Class</a></li>
  291. <li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography Class</a></li>
  292. <li class="toctree-l2"><a class="reference internal" href="../libraries/unit_testing.html">Unit Testing Class</a></li>
  293. <li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">URI Class</a></li>
  294. <li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li>
  295. <li class="toctree-l2"><a class="reference internal" href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
  296. <li class="toctree-l2"><a class="reference internal" href="../libraries/zip.html">Zip Encoding Class</a></li>
  297. </ul>
  298. </li>
  299. </ul>
  300. <ul>
  301. <li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
  302. <li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
  303. <li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
  304. <li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
  305. <li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
  306. <li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
  307. <li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
  308. <li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
  309. <li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
  310. <li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
  311. <li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
  312. <li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
  313. <li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
  314. <li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
  315. <li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
  316. </ul>
  317. </li>
  318. </ul>
  319. <ul class="current">
  320. <li class="toctree-l1 current"><a class="reference internal" href="index.html">Helpers</a><ul class="current">
  321. <li class="toctree-l2"><a class="reference internal" href="array_helper.html">Array Helper</a></li>
  322. <li class="toctree-l2"><a class="reference internal" href="captcha_helper.html">CAPTCHA Helper</a></li>
  323. <li class="toctree-l2"><a class="reference internal" href="cookie_helper.html">Cookie Helper</a></li>
  324. <li class="toctree-l2 current"><a class="current reference internal" href="#">Date Helper</a></li>
  325. <li class="toctree-l2"><a class="reference internal" href="directory_helper.html">Directory Helper</a></li>
  326. <li class="toctree-l2"><a class="reference internal" href="download_helper.html">Download Helper</a></li>
  327. <li class="toctree-l2"><a class="reference internal" href="email_helper.html">Email Helper</a></li>
  328. <li class="toctree-l2"><a class="reference internal" href="file_helper.html">File Helper</a></li>
  329. <li class="toctree-l2"><a class="reference internal" href="form_helper.html">Form Helper</a></li>
  330. <li class="toctree-l2"><a class="reference internal" href="html_helper.html">HTML Helper</a></li>
  331. <li class="toctree-l2"><a class="reference internal" href="inflector_helper.html">Inflector Helper</a></li>
  332. <li class="toctree-l2"><a class="reference internal" href="language_helper.html">Language Helper</a></li>
  333. <li class="toctree-l2"><a class="reference internal" href="number_helper.html">Number Helper</a></li>
  334. <li class="toctree-l2"><a class="reference internal" href="path_helper.html">Path Helper</a></li>
  335. <li class="toctree-l2"><a class="reference internal" href="security_helper.html">Security Helper</a></li>
  336. <li class="toctree-l2"><a class="reference internal" href="smiley_helper.html">Smiley Helper</a></li>
  337. <li class="toctree-l2"><a class="reference internal" href="string_helper.html">String Helper</a></li>
  338. <li class="toctree-l2"><a class="reference internal" href="text_helper.html">Text Helper</a></li>
  339. <li class="toctree-l2"><a class="reference internal" href="typography_helper.html">Typography Helper</a></li>
  340. <li class="toctree-l2"><a class="reference internal" href="url_helper.html">URL Helper</a></li>
  341. <li class="toctree-l2"><a class="reference internal" href="xml_helper.html">XML Helper</a></li>
  342. </ul>
  343. </li>
  344. </ul>
  345. </div>
  346. &nbsp;
  347. </nav>
  348. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  349. <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
  350. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  351. <a href="../index.html">CodeIgniter</a>
  352. </nav>
  353. <div class="wy-nav-content">
  354. <div class="rst-content">
  355. <div role="navigation" aria-label="breadcrumbs navigation">
  356. <ul class="wy-breadcrumbs">
  357. <li><a href="../index.html">Docs</a> &raquo;</li>
  358. <li><a href="index.html">Helpers</a> &raquo;</li>
  359. <li>Date Helper</li>
  360. <li class="wy-breadcrumbs-aside">
  361. </li>
  362. <div style="float:right;margin-left:5px;" id="closeMe">
  363. <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" />
  364. </div>
  365. </ul>
  366. <hr/>
  367. </div>
  368. <div role="main" class="document">
  369. <div class="section" id="date-helper">
  370. <h1>Date Helper<a class="headerlink" href="#date-helper" title="Permalink to this headline">¶</a></h1>
  371. <p>The Date Helper file contains functions that help you work with dates.</p>
  372. <div class="contents local topic" id="contents">
  373. <ul class="simple">
  374. <li><a class="reference internal" href="#loading-this-helper" id="id1">Loading this Helper</a></li>
  375. <li><a class="reference internal" href="#available-functions" id="id2">Available Functions</a></li>
  376. <li><a class="reference internal" href="#timezone-reference" id="id3">Timezone Reference</a></li>
  377. </ul>
  378. </div>
  379. <div class="custom-index container"></div><div class="section" id="loading-this-helper">
  380. <h2><a class="toc-backref" href="#id1">Loading this Helper</a><a class="headerlink" href="#loading-this-helper" title="Permalink to this headline">¶</a></h2>
  381. <p>This helper is loaded using the following code:</p>
  382. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">helper</span><span class="p">(</span><span class="s1">&#39;date&#39;</span><span class="p">);</span>
  383. </pre></div>
  384. </div>
  385. </div>
  386. <div class="section" id="available-functions">
  387. <h2><a class="toc-backref" href="#id2">Available Functions</a><a class="headerlink" href="#available-functions" title="Permalink to this headline">¶</a></h2>
  388. <p>The following functions are available:</p>
  389. <dl class="function">
  390. <dt id="now">
  391. <code class="descname">now</code><span class="sig-paren">(</span><span class="optional">[</span><em>$timezone = NULL</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#now" title="Permalink to this definition">¶</a></dt>
  392. <dd><table class="docutils field-list" frame="void" rules="none">
  393. <col class="field-name" />
  394. <col class="field-body" />
  395. <tbody valign="top">
  396. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  397. <li><strong>$timezone</strong> (<em>string</em>) – Timezone</li>
  398. </ul>
  399. </td>
  400. </tr>
  401. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">UNIX timestamp</p>
  402. </td>
  403. </tr>
  404. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
  405. </td>
  406. </tr>
  407. </tbody>
  408. </table>
  409. <p>Returns the current time as a UNIX timestamp, referenced either to your server’s
  410. local time or any PHP supported timezone, based on the “time reference” setting
  411. in your config file. If you do not intend to set your master time reference to
  412. any other PHP supported timezone (which you’ll typically do if you run a site
  413. that lets each user set their own timezone settings) there is no benefit to using
  414. this function over PHP’s <code class="docutils literal"><span class="pre">time()</span></code> function.</p>
  415. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nx">now</span><span class="p">(</span><span class="s1">&#39;Australia/Victoria&#39;</span><span class="p">);</span>
  416. </pre></div>
  417. </div>
  418. <p>If a timezone is not provided, it will return <code class="docutils literal"><span class="pre">time()</span></code> based on the
  419. <strong>time_reference</strong> setting.</p>
  420. </dd></dl>
  421. <dl class="function">
  422. <dt id="mdate">
  423. <code class="descname">mdate</code><span class="sig-paren">(</span><span class="optional">[</span><em>$datestr = ''</em><span class="optional">[</span>, <em>$time = ''</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#mdate" title="Permalink to this definition">¶</a></dt>
  424. <dd><table class="docutils field-list" frame="void" rules="none">
  425. <col class="field-name" />
  426. <col class="field-body" />
  427. <tbody valign="top">
  428. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  429. <li><strong>$datestr</strong> (<em>string</em>) – Date string</li>
  430. <li><strong>$time</strong> (<em>int</em>) – UNIX timestamp</li>
  431. </ul>
  432. </td>
  433. </tr>
  434. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">MySQL-formatted date</p>
  435. </td>
  436. </tr>
  437. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  438. </td>
  439. </tr>
  440. </tbody>
  441. </table>
  442. <p>This function is identical to PHP’s <a class="reference external" href="http://php.net/manual/en/function.date.php">date()</a>
  443. function, except that it lets you use MySQL style date codes, where each
  444. code letter is preceded with a percent sign, e.g. <cite>%Y %m %d</cite></p>
  445. <p>The benefit of doing dates this way is that you don’t have to worry
  446. about escaping any characters that are not date codes, as you would
  447. normally have to do with the <code class="docutils literal"><span class="pre">date()</span></code> function.</p>
  448. <p>Example:</p>
  449. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$datestring</span> <span class="o">=</span> <span class="s1">&#39;Year: %Y Month: %m Day: %d - %h:%i %a&#39;</span><span class="p">;</span>
  450. <span class="nv">$time</span> <span class="o">=</span> <span class="nb">time</span><span class="p">();</span>
  451. <span class="k">echo</span> <span class="nx">mdate</span><span class="p">(</span><span class="nv">$datestring</span><span class="p">,</span> <span class="nv">$time</span><span class="p">);</span>
  452. </pre></div>
  453. </div>
  454. <p>If a timestamp is not included in the second parameter the current time
  455. will be used.</p>
  456. </dd></dl>
  457. <dl class="function">
  458. <dt id="standard_date">
  459. <code class="descname">standard_date</code><span class="sig-paren">(</span><span class="optional">[</span><em>$fmt = 'DATE_RFC822'</em><span class="optional">[</span>, <em>$time = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#standard_date" title="Permalink to this definition">¶</a></dt>
  460. <dd><table class="docutils field-list" frame="void" rules="none">
  461. <col class="field-name" />
  462. <col class="field-body" />
  463. <tbody valign="top">
  464. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  465. <li><strong>$fmt</strong> (<em>string</em>) – Date format</li>
  466. <li><strong>$time</strong> (<em>int</em>) – UNIX timestamp</li>
  467. </ul>
  468. </td>
  469. </tr>
  470. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Formatted date or FALSE on invalid format</p>
  471. </td>
  472. </tr>
  473. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  474. </td>
  475. </tr>
  476. </tbody>
  477. </table>
  478. <p>Lets you generate a date string in one of several standardized formats.</p>
  479. <p>Example:</p>
  480. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$format</span> <span class="o">=</span> <span class="s1">&#39;DATE_RFC822&#39;</span><span class="p">;</span>
  481. <span class="nv">$time</span> <span class="o">=</span> <span class="nb">time</span><span class="p">();</span>
  482. <span class="k">echo</span> <span class="nx">standard_date</span><span class="p">(</span><span class="nv">$format</span><span class="p">,</span> <span class="nv">$time</span><span class="p">);</span>
  483. </pre></div>
  484. </div>
  485. <div class="admonition note">
  486. <p class="first admonition-title">Note</p>
  487. <p>This function is DEPRECATED. Use the native <code class="docutils literal"><span class="pre">date()</span></code> combined with
  488. <a class="reference external" href="https://secure.php.net/manual/en/class.datetime.php#datetime.constants.types">DateTime’s format constants</a>
  489. instead:</p>
  490. <div class="last highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nb">date</span><span class="p">(</span><span class="nx">DATE_RFC822</span><span class="p">,</span> <span class="nb">time</span><span class="p">());</span>
  491. </pre></div>
  492. </div>
  493. </div>
  494. <p><strong>Supported formats:</strong></p>
  495. <table border="1" class="docutils">
  496. <colgroup>
  497. <col width="20%" />
  498. <col width="30%" />
  499. <col width="50%" />
  500. </colgroup>
  501. <thead valign="bottom">
  502. <tr class="row-odd"><th class="head">Constant</th>
  503. <th class="head">Description</th>
  504. <th class="head">Example</th>
  505. </tr>
  506. </thead>
  507. <tbody valign="top">
  508. <tr class="row-even"><td>DATE_ATOM</td>
  509. <td>Atom</td>
  510. <td>2005-08-15T16:13:03+0000</td>
  511. </tr>
  512. <tr class="row-odd"><td>DATE_COOKIE</td>
  513. <td>HTTP Cookies</td>
  514. <td>Sun, 14 Aug 2005 16:13:03 UTC</td>
  515. </tr>
  516. <tr class="row-even"><td>DATE_ISO8601</td>
  517. <td>ISO-8601</td>
  518. <td>2005-08-14T16:13:03+00:00</td>
  519. </tr>
  520. <tr class="row-odd"><td>DATE_RFC822</td>
  521. <td>RFC 822</td>
  522. <td>Sun, 14 Aug 05 16:13:03 UTC</td>
  523. </tr>
  524. <tr class="row-even"><td>DATE_RFC850</td>
  525. <td>RFC 850</td>
  526. <td>Sunday, 14-Aug-05 16:13:03 UTC</td>
  527. </tr>
  528. <tr class="row-odd"><td>DATE_RFC1036</td>
  529. <td>RFC 1036</td>
  530. <td>Sunday, 14-Aug-05 16:13:03 UTC</td>
  531. </tr>
  532. <tr class="row-even"><td>DATE_RFC1123</td>
  533. <td>RFC 1123</td>
  534. <td>Sun, 14 Aug 2005 16:13:03 UTC</td>
  535. </tr>
  536. <tr class="row-odd"><td>DATE_RFC2822</td>
  537. <td>RFC 2822</td>
  538. <td>Sun, 14 Aug 2005 16:13:03 +0000</td>
  539. </tr>
  540. <tr class="row-even"><td>DATE_RSS</td>
  541. <td>RSS</td>
  542. <td>Sun, 14 Aug 2005 16:13:03 UTC</td>
  543. </tr>
  544. <tr class="row-odd"><td>DATE_W3C</td>
  545. <td>W3C</td>
  546. <td>2005-08-14T16:13:03+0000</td>
  547. </tr>
  548. </tbody>
  549. </table>
  550. </dd></dl>
  551. <dl class="function">
  552. <dt id="local_to_gmt">
  553. <code class="descname">local_to_gmt</code><span class="sig-paren">(</span><span class="optional">[</span><em>$time = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#local_to_gmt" title="Permalink to this definition">¶</a></dt>
  554. <dd><table class="docutils field-list" frame="void" rules="none">
  555. <col class="field-name" />
  556. <col class="field-body" />
  557. <tbody valign="top">
  558. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  559. <li><strong>$time</strong> (<em>int</em>) – UNIX timestamp</li>
  560. </ul>
  561. </td>
  562. </tr>
  563. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">UNIX timestamp</p>
  564. </td>
  565. </tr>
  566. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
  567. </td>
  568. </tr>
  569. </tbody>
  570. </table>
  571. <p>Takes a UNIX timestamp as input and returns it as GMT.</p>
  572. <p>Example:</p>
  573. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$gmt</span> <span class="o">=</span> <span class="nx">local_to_gmt</span><span class="p">(</span><span class="nb">time</span><span class="p">());</span>
  574. </pre></div>
  575. </div>
  576. </dd></dl>
  577. <dl class="function">
  578. <dt id="gmt_to_local">
  579. <code class="descname">gmt_to_local</code><span class="sig-paren">(</span><span class="optional">[</span><em>$time = ''</em><span class="optional">[</span>, <em>$timezone = 'UTC'</em><span class="optional">[</span>, <em>$dst = FALSE</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#gmt_to_local" title="Permalink to this definition">¶</a></dt>
  580. <dd><table class="docutils field-list" frame="void" rules="none">
  581. <col class="field-name" />
  582. <col class="field-body" />
  583. <tbody valign="top">
  584. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  585. <li><strong>$time</strong> (<em>int</em>) – UNIX timestamp</li>
  586. <li><strong>$timezone</strong> (<em>string</em>) – Timezone</li>
  587. <li><strong>$dst</strong> (<em>bool</em>) – Whether DST is active</li>
  588. </ul>
  589. </td>
  590. </tr>
  591. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">UNIX timestamp</p>
  592. </td>
  593. </tr>
  594. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
  595. </td>
  596. </tr>
  597. </tbody>
  598. </table>
  599. <p>Takes a UNIX timestamp (referenced to GMT) as input, and converts it to
  600. a localized timestamp based on the timezone and Daylight Saving Time
  601. submitted.</p>
  602. <p>Example:</p>
  603. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$timestamp</span> <span class="o">=</span> <span class="mi">1140153693</span><span class="p">;</span>
  604. <span class="nv">$timezone</span> <span class="o">=</span> <span class="s1">&#39;UM8&#39;</span><span class="p">;</span>
  605. <span class="nv">$daylight_saving</span> <span class="o">=</span> <span class="k">TRUE</span><span class="p">;</span>
  606. <span class="k">echo</span> <span class="nx">gmt_to_local</span><span class="p">(</span><span class="nv">$timestamp</span><span class="p">,</span> <span class="nv">$timezone</span><span class="p">,</span> <span class="nv">$daylight_saving</span><span class="p">);</span>
  607. </pre></div>
  608. </div>
  609. <div class="admonition note">
  610. <p class="first admonition-title">Note</p>
  611. <p class="last">For a list of timezones see the reference at the bottom of this page.</p>
  612. </div>
  613. </dd></dl>
  614. <dl class="function">
  615. <dt id="mysql_to_unix">
  616. <code class="descname">mysql_to_unix</code><span class="sig-paren">(</span><span class="optional">[</span><em>$time = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#mysql_to_unix" title="Permalink to this definition">¶</a></dt>
  617. <dd><table class="docutils field-list" frame="void" rules="none">
  618. <col class="field-name" />
  619. <col class="field-body" />
  620. <tbody valign="top">
  621. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  622. <li><strong>$time</strong> (<em>string</em>) – MySQL timestamp</li>
  623. </ul>
  624. </td>
  625. </tr>
  626. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">UNIX timestamp</p>
  627. </td>
  628. </tr>
  629. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
  630. </td>
  631. </tr>
  632. </tbody>
  633. </table>
  634. <p>Takes a MySQL Timestamp as input and returns it as a UNIX timestamp.</p>
  635. <p>Example:</p>
  636. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$unix</span> <span class="o">=</span> <span class="nx">mysql_to_unix</span><span class="p">(</span><span class="s1">&#39;20061124092345&#39;</span><span class="p">);</span>
  637. </pre></div>
  638. </div>
  639. </dd></dl>
  640. <dl class="function">
  641. <dt id="unix_to_human">
  642. <code class="descname">unix_to_human</code><span class="sig-paren">(</span><span class="optional">[</span><em>$time = ''</em><span class="optional">[</span>, <em>$seconds = FALSE</em><span class="optional">[</span>, <em>$fmt = 'us'</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#unix_to_human" title="Permalink to this definition">¶</a></dt>
  643. <dd><table class="docutils field-list" frame="void" rules="none">
  644. <col class="field-name" />
  645. <col class="field-body" />
  646. <tbody valign="top">
  647. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  648. <li><strong>$time</strong> (<em>int</em>) – UNIX timestamp</li>
  649. <li><strong>$seconds</strong> (<em>bool</em>) – Whether to show seconds</li>
  650. <li><strong>$fmt</strong> (<em>string</em>) – format (us or euro)</li>
  651. </ul>
  652. </td>
  653. </tr>
  654. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Formatted date</p>
  655. </td>
  656. </tr>
  657. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  658. </td>
  659. </tr>
  660. </tbody>
  661. </table>
  662. <p>Takes a UNIX timestamp as input and returns it in a human readable
  663. format with this prototype:</p>
  664. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">YYYY</span><span class="o">-</span><span class="nx">MM</span><span class="o">-</span><span class="nx">DD</span> <span class="nx">HH</span><span class="o">:</span><span class="nx">MM</span><span class="o">:</span><span class="nx">SS</span> <span class="nx">AM</span><span class="o">/</span><span class="nx">PM</span>
  665. </pre></div>
  666. </div>
  667. <p>This can be useful if you need to display a date in a form field for
  668. submission.</p>
  669. <p>The time can be formatted with or without seconds, and it can be set to
  670. European or US format. If only the timestamp is submitted it will return
  671. the time without seconds formatted for the U.S.</p>
  672. <p>Examples:</p>
  673. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$now</span> <span class="o">=</span> <span class="nb">time</span><span class="p">();</span>
  674. <span class="k">echo</span> <span class="nx">unix_to_human</span><span class="p">(</span><span class="nv">$now</span><span class="p">);</span> <span class="c1">// U.S. time, no seconds</span>
  675. <span class="k">echo</span> <span class="nx">unix_to_human</span><span class="p">(</span><span class="nv">$now</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">,</span> <span class="s1">&#39;us&#39;</span><span class="p">);</span> <span class="c1">// U.S. time with seconds</span>
  676. <span class="k">echo</span> <span class="nx">unix_to_human</span><span class="p">(</span><span class="nv">$now</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">,</span> <span class="s1">&#39;eu&#39;</span><span class="p">);</span> <span class="c1">// Euro time with seconds</span>
  677. </pre></div>
  678. </div>
  679. </dd></dl>
  680. <dl class="function">
  681. <dt id="human_to_unix">
  682. <code class="descname">human_to_unix</code><span class="sig-paren">(</span><span class="optional">[</span><em>$datestr = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#human_to_unix" title="Permalink to this definition">¶</a></dt>
  683. <dd><table class="docutils field-list" frame="void" rules="none">
  684. <col class="field-name" />
  685. <col class="field-body" />
  686. <tbody valign="top">
  687. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  688. <li><strong>$datestr</strong> (<em>int</em>) – Date string</li>
  689. </ul>
  690. </td>
  691. </tr>
  692. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">UNIX timestamp or FALSE on failure</p>
  693. </td>
  694. </tr>
  695. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
  696. </td>
  697. </tr>
  698. </tbody>
  699. </table>
  700. <p>The opposite of the <code class="xref php php-func docutils literal"><span class="pre">unix_to_time()</span></code> function. Takes a “human”
  701. time as input and returns it as a UNIX timestamp. This is useful if you
  702. accept “human” formatted dates submitted via a form. Returns boolean FALSE
  703. date string passed to it is not formatted as indicated above.</p>
  704. <p>Example:</p>
  705. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$now</span> <span class="o">=</span> <span class="nb">time</span><span class="p">();</span>
  706. <span class="nv">$human</span> <span class="o">=</span> <span class="nx">unix_to_human</span><span class="p">(</span><span class="nv">$now</span><span class="p">);</span>
  707. <span class="nv">$unix</span> <span class="o">=</span> <span class="nx">human_to_unix</span><span class="p">(</span><span class="nv">$human</span><span class="p">);</span>
  708. </pre></div>
  709. </div>
  710. </dd></dl>
  711. <dl class="function">
  712. <dt id="nice_date">
  713. <code class="descname">nice_date</code><span class="sig-paren">(</span><span class="optional">[</span><em>$bad_date = ''</em><span class="optional">[</span>, <em>$format = FALSE</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#nice_date" title="Permalink to this definition">¶</a></dt>
  714. <dd><table class="docutils field-list" frame="void" rules="none">
  715. <col class="field-name" />
  716. <col class="field-body" />
  717. <tbody valign="top">
  718. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  719. <li><strong>$bad_date</strong> (<em>int</em>) – The terribly formatted date-like string</li>
  720. <li><strong>$format</strong> (<em>string</em>) – Date format to return (same as PHP’s <code class="docutils literal"><span class="pre">date()</span></code> function)</li>
  721. </ul>
  722. </td>
  723. </tr>
  724. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Formatted date</p>
  725. </td>
  726. </tr>
  727. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  728. </td>
  729. </tr>
  730. </tbody>
  731. </table>
  732. <p>This function can take a number poorly-formed date formats and convert
  733. them into something useful. It also accepts well-formed dates.</p>
  734. <p>The function will return a UNIX timestamp by default. You can, optionally,
  735. pass a format string (the same type as the PHP <code class="docutils literal"><span class="pre">date()</span></code> function accepts)
  736. as the second parameter.</p>
  737. <p>Example:</p>
  738. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$bad_date</span> <span class="o">=</span> <span class="s1">&#39;199605&#39;</span><span class="p">;</span>
  739. <span class="c1">// Should Produce: 1996-05-01</span>
  740. <span class="nv">$better_date</span> <span class="o">=</span> <span class="nx">nice_date</span><span class="p">(</span><span class="nv">$bad_date</span><span class="p">,</span> <span class="s1">&#39;Y-m-d&#39;</span><span class="p">);</span>
  741. <span class="nv">$bad_date</span> <span class="o">=</span> <span class="s1">&#39;9-11-2001&#39;</span><span class="p">;</span>
  742. <span class="c1">// Should Produce: 2001-09-11</span>
  743. <span class="nv">$better_date</span> <span class="o">=</span> <span class="nx">nice_date</span><span class="p">(</span><span class="nv">$bad_date</span><span class="p">,</span> <span class="s1">&#39;Y-m-d&#39;</span><span class="p">);</span>
  744. </pre></div>
  745. </div>
  746. <div class="admonition note">
  747. <p class="first admonition-title">Note</p>
  748. <p class="last">This function is DEPRECATED. Use PHP’s native <a class="reference external" href="https://secure.php.net/datetime">DateTime class</a> instead.</p>
  749. </div>
  750. </dd></dl>
  751. <dl class="function">
  752. <dt id="timespan">
  753. <code class="descname">timespan</code><span class="sig-paren">(</span><span class="optional">[</span><em>$seconds = 1</em><span class="optional">[</span>, <em>$time = ''</em><span class="optional">[</span>, <em>$units = ''</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#timespan" title="Permalink to this definition">¶</a></dt>
  754. <dd><table class="docutils field-list" frame="void" rules="none">
  755. <col class="field-name" />
  756. <col class="field-body" />
  757. <tbody valign="top">
  758. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  759. <li><strong>$seconds</strong> (<em>int</em>) – Number of seconds</li>
  760. <li><strong>$time</strong> (<em>string</em>) – UNIX timestamp</li>
  761. <li><strong>$units</strong> (<em>int</em>) – Number of time units to display</li>
  762. </ul>
  763. </td>
  764. </tr>
  765. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Formatted time difference</p>
  766. </td>
  767. </tr>
  768. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  769. </td>
  770. </tr>
  771. </tbody>
  772. </table>
  773. <p>Formats a UNIX timestamp so that is appears similar to this:</p>
  774. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="mi">1</span> <span class="nx">Year</span><span class="p">,</span> <span class="mi">10</span> <span class="nx">Months</span><span class="p">,</span> <span class="mi">2</span> <span class="nx">Weeks</span><span class="p">,</span> <span class="mi">5</span> <span class="nx">Days</span><span class="p">,</span> <span class="mi">10</span> <span class="nx">Hours</span><span class="p">,</span> <span class="mi">16</span> <span class="nx">Minutes</span>
  775. </pre></div>
  776. </div>
  777. <p>The first parameter must contain a UNIX timestamp.
  778. The second parameter must contain a timestamp that is greater that the
  779. first timestamp.
  780. The thirdparameter is optional and limits the number of time units to display.</p>
  781. <p>If the second parameter empty, the current time will be used.</p>
  782. <p>The most common purpose for this function is to show how much time has
  783. elapsed from some point in time in the past to now.</p>
  784. <p>Example:</p>
  785. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$post_date</span> <span class="o">=</span> <span class="s1">&#39;1079621429&#39;</span><span class="p">;</span>
  786. <span class="nv">$now</span> <span class="o">=</span> <span class="nb">time</span><span class="p">();</span>
  787. <span class="nv">$units</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span>
  788. <span class="k">echo</span> <span class="nx">timespan</span><span class="p">(</span><span class="nv">$post_date</span><span class="p">,</span> <span class="nv">$now</span><span class="p">,</span> <span class="nv">$units</span><span class="p">);</span>
  789. </pre></div>
  790. </div>
  791. <div class="admonition note">
  792. <p class="first admonition-title">Note</p>
  793. <p class="last">The text generated by this function is found in the following language
  794. file: <cite>language/&lt;your_lang&gt;/date_lang.php</cite></p>
  795. </div>
  796. </dd></dl>
  797. <dl class="function">
  798. <dt id="days_in_month">
  799. <code class="descname">days_in_month</code><span class="sig-paren">(</span><span class="optional">[</span><em>$month = 0</em><span class="optional">[</span>, <em>$year = ''</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#days_in_month" title="Permalink to this definition">¶</a></dt>
  800. <dd><table class="docutils field-list" frame="void" rules="none">
  801. <col class="field-name" />
  802. <col class="field-body" />
  803. <tbody valign="top">
  804. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  805. <li><strong>$month</strong> (<em>int</em>) – a numeric month</li>
  806. <li><strong>$year</strong> (<em>int</em>) – a numeric year</li>
  807. </ul>
  808. </td>
  809. </tr>
  810. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Count of days in the specified month</p>
  811. </td>
  812. </tr>
  813. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
  814. </td>
  815. </tr>
  816. </tbody>
  817. </table>
  818. <p>Returns the number of days in a given month/year. Takes leap years into
  819. account.</p>
  820. <p>Example:</p>
  821. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nx">days_in_month</span><span class="p">(</span><span class="mo">06</span><span class="p">,</span> <span class="mi">2005</span><span class="p">);</span>
  822. </pre></div>
  823. </div>
  824. <p>If the second parameter is empty, the current year will be used.</p>
  825. <div class="admonition note">
  826. <p class="first admonition-title">Note</p>
  827. <p class="last">This function will alias the native <code class="docutils literal"><span class="pre">cal_days_in_month()</span></code>, if
  828. it is available.</p>
  829. </div>
  830. </dd></dl>
  831. <dl class="function">
  832. <dt id="date_range">
  833. <code class="descname">date_range</code><span class="sig-paren">(</span><span class="optional">[</span><em>$unix_start = ''</em><span class="optional">[</span>, <em>$mixed = ''</em><span class="optional">[</span>, <em>$is_unix = TRUE</em><span class="optional">[</span>, <em>$format = 'Y-m-d'</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#date_range" title="Permalink to this definition">¶</a></dt>
  834. <dd><table class="docutils field-list" frame="void" rules="none">
  835. <col class="field-name" />
  836. <col class="field-body" />
  837. <tbody valign="top">
  838. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  839. <li><strong>$unix_start</strong> (<em>int</em>) – UNIX timestamp of the range start date</li>
  840. <li><strong>$mixed</strong> (<em>int</em>) – UNIX timestamp of the range end date or interval in days</li>
  841. <li><strong>$is_unix</strong> (<em>bool</em>) – set to FALSE if $mixed is not a timestamp</li>
  842. <li><strong>$format</strong> (<em>string</em>) – Output date format, same as in <code class="docutils literal"><span class="pre">date()</span></code></li>
  843. </ul>
  844. </td>
  845. </tr>
  846. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An array of dates</p>
  847. </td>
  848. </tr>
  849. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
  850. </td>
  851. </tr>
  852. </tbody>
  853. </table>
  854. <p>Returns a list of dates within a specified period.</p>
  855. <p>Example:</p>
  856. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$range</span> <span class="o">=</span> <span class="nx">date_range</span><span class="p">(</span><span class="s1">&#39;2012-01-01&#39;</span><span class="p">,</span> <span class="s1">&#39;2012-01-15&#39;</span><span class="p">);</span>
  857. <span class="k">echo</span> <span class="s2">&quot;First 15 days of 2012:&quot;</span><span class="p">;</span>
  858. <span class="k">foreach</span> <span class="p">(</span><span class="nv">$range</span> <span class="k">as</span> <span class="nv">$date</span><span class="p">)</span>
  859. <span class="p">{</span>
  860. <span class="k">echo</span> <span class="nv">$date</span><span class="o">.</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
  861. <span class="p">}</span>
  862. </pre></div>
  863. </div>
  864. </dd></dl>
  865. <dl class="function">
  866. <dt id="timezones">
  867. <code class="descname">timezones</code><span class="sig-paren">(</span><span class="optional">[</span><em>$tz = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#timezones" title="Permalink to this definition">¶</a></dt>
  868. <dd><table class="docutils field-list" frame="void" rules="none">
  869. <col class="field-name" />
  870. <col class="field-body" />
  871. <tbody valign="top">
  872. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  873. <li><strong>$tz</strong> (<em>string</em>) – A numeric timezone</li>
  874. </ul>
  875. </td>
  876. </tr>
  877. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Hour difference from UTC</p>
  878. </td>
  879. </tr>
  880. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">int</p>
  881. </td>
  882. </tr>
  883. </tbody>
  884. </table>
  885. <p>Takes a timezone reference (for a list of valid timezones, see the
  886. “Timezone Reference” below) and returns the number of hours offset from
  887. UTC.</p>
  888. <p>Example:</p>
  889. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nx">timezones</span><span class="p">(</span><span class="s1">&#39;UM5&#39;</span><span class="p">);</span>
  890. </pre></div>
  891. </div>
  892. <p>This function is useful when used with <a class="reference internal" href="#timezone_menu" title="timezone_menu"><code class="xref php php-func docutils literal"><span class="pre">timezone_menu()</span></code></a>.</p>
  893. </dd></dl>
  894. <dl class="function">
  895. <dt id="timezone_menu">
  896. <code class="descname">timezone_menu</code><span class="sig-paren">(</span><span class="optional">[</span><em>$default = 'UTC'</em><span class="optional">[</span>, <em>$class = ''</em><span class="optional">[</span>, <em>$name = 'timezones'</em><span class="optional">[</span>, <em>$attributes = ''</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#timezone_menu" title="Permalink to this definition">¶</a></dt>
  897. <dd><table class="docutils field-list" frame="void" rules="none">
  898. <col class="field-name" />
  899. <col class="field-body" />
  900. <tbody valign="top">
  901. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  902. <li><strong>$default</strong> (<em>string</em>) – Timezone</li>
  903. <li><strong>$class</strong> (<em>string</em>) – Class name</li>
  904. <li><strong>$name</strong> (<em>string</em>) – Menu name</li>
  905. <li><strong>$attributes</strong> (<em>mixed</em>) – HTML attributes</li>
  906. </ul>
  907. </td>
  908. </tr>
  909. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">HTML drop down menu with time zones</p>
  910. </td>
  911. </tr>
  912. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
  913. </td>
  914. </tr>
  915. </tbody>
  916. </table>
  917. <p>Generates a pull-down menu of timezones, like this one:</p>
  918. <form action="#">
  919. <select name="timezones">
  920. <option value='UM12'>(UTC -12:00) Baker/Howland Island</option>
  921. <option value='UM11'>(UTC -11:00) Samoa Time Zone, Niue</option>
  922. <option value='UM10'>(UTC -10:00) Hawaii-Aleutian Standard Time, Cook Islands, Tahiti</option>
  923. <option value='UM95'>(UTC -9:30) Marquesas Islands</option>
  924. <option value='UM9'>(UTC -9:00) Alaska Standard Time, Gambier Islands</option>
  925. <option value='UM8'>(UTC -8:00) Pacific Standard Time, Clipperton Island</option>
  926. <option value='UM7'>(UTC -7:00) Mountain Standard Time</option>
  927. <option value='UM6'>(UTC -6:00) Central Standard Time</option>
  928. <option value='UM5'>(UTC -5:00) Eastern Standard Time, Western Caribbean Standard Time</option>
  929. <option value='UM45'>(UTC -4:30) Venezuelan Standard Time</option>
  930. <option value='UM4'>(UTC -4:00) Atlantic Standard Time, Eastern Caribbean Standard Time</option>
  931. <option value='UM35'>(UTC -3:30) Newfoundland Standard Time</option>
  932. <option value='UM3'>(UTC -3:00) Argentina, Brazil, French Guiana, Uruguay</option>
  933. <option value='UM2'>(UTC -2:00) South Georgia/South Sandwich Islands</option>
  934. <option value='UM1'>(UTC -1:00) Azores, Cape Verde Islands</option>
  935. <option value='UTC' selected='selected'>(UTC) Greenwich Mean Time, Western European Time</option>
  936. <option value='UP1'>(UTC +1:00) Central European Time, West Africa Time</option>
  937. <option value='UP2'>(UTC +2:00) Central Africa Time, Eastern European Time, Kaliningrad Time</option>
  938. <option value='UP3'>(UTC +3:00) Moscow Time, East Africa Time</option>
  939. <option value='UP35'>(UTC +3:30) Iran Standard Time</option>
  940. <option value='UP4'>(UTC +4:00) Azerbaijan Standard Time, Samara Time</option>
  941. <option value='UP45'>(UTC +4:30) Afghanistan</option>
  942. <option value='UP5'>(UTC +5:00) Pakistan Standard Time, Yekaterinburg Time</option>
  943. <option value='UP55'>(UTC +5:30) Indian Standard Time, Sri Lanka Time</option>
  944. <option value='UP575'>(UTC +5:45) Nepal Time</option>
  945. <option value='UP6'>(UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time</option>
  946. <option value='UP65'>(UTC +6:30) Cocos Islands, Myanmar</option>
  947. <option value='UP7'>(UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam</option>
  948. <option value='UP8'>(UTC +8:00) Australian Western Standard Time, Beijing Time, Irkutsk Time</option>
  949. <option value='UP875'>(UTC +8:45) Australian Central Western Standard Time</option>
  950. <option value='UP9'>(UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk Time</option>
  951. <option value='UP95'>(UTC +9:30) Australian Central Standard Time</option>
  952. <option value='UP10'>(UTC +10:00) Australian Eastern Standard Time, Vladivostok Time</option>
  953. <option value='UP105'>(UTC +10:30) Lord Howe Island</option>
  954. <option value='UP11'>(UTC +11:00) Srednekolymsk Time, Solomon Islands, Vanuatu</option>
  955. <option value='UP115'>(UTC +11:30) Norfolk Island</option>
  956. <option value='UP12'>(UTC +12:00) Fiji, Gilbert Islands, Kamchatka Time, New Zealand Standard Time</option>
  957. <option value='UP1275'>(UTC +12:45) Chatham Islands Standard Time</option>
  958. <option value='UP13'>(UTC +13:00) Phoenix Islands Time, Tonga</option>
  959. <option value='UP14'>(UTC +14:00) Line Islands</option>
  960. </select>
  961. </form><p>This menu is useful if you run a membership site in which your users are
  962. allowed to set their local timezone value.</p>
  963. <p>The first parameter lets you set the “selected” state of the menu. For
  964. example, to set Pacific time as the default you will do this:</p>
  965. <div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nx">timezone_menu</span><span class="p">(</span><span class="s1">&#39;UM8&#39;</span><span class="p">);</span>
  966. </pre></div>
  967. </div>
  968. <p>Please see the timezone reference below to see the values of this menu.</p>
  969. <p>The second parameter lets you set a CSS class name for the menu.</p>
  970. <p>The fourth parameter lets you set one or more attributes on the generated select tag.</p>
  971. <div class="admonition note">
  972. <p class="first admonition-title">Note</p>
  973. <p class="last">The text contained in the menu is found in the following
  974. language file: <cite>language/&lt;your_lang&gt;/date_lang.php</cite></p>
  975. </div>
  976. </dd></dl>
  977. </div>
  978. <div class="section" id="timezone-reference">
  979. <h2><a class="toc-backref" href="#id3">Timezone Reference</a><a class="headerlink" href="#timezone-reference" title="Permalink to this headline">¶</a></h2>
  980. <p>The following table indicates each timezone and its location.</p>
  981. <p>Note some of the location lists have been abridged for clarity and formatting.</p>
  982. <table border="1" class="docutils">
  983. <colgroup>
  984. <col width="14%" />
  985. <col width="86%" />
  986. </colgroup>
  987. <thead valign="bottom">
  988. <tr class="row-odd"><th class="head">Time Zone</th>
  989. <th class="head">Location</th>
  990. </tr>
  991. </thead>
  992. <tbody valign="top">
  993. <tr class="row-even"><td>UM12</td>
  994. <td>(UTC - 12:00) Baker/Howland Island</td>
  995. </tr>
  996. <tr class="row-odd"><td>UM11</td>
  997. <td>(UTC - 11:00) Samoa Time Zone, Niue</td>
  998. </tr>
  999. <tr class="row-even"><td>UM10</td>
  1000. <td>(UTC - 10:00) Hawaii-Aleutian Standard Time, Cook Islands</td>
  1001. </tr>
  1002. <tr class="row-odd"><td>UM95</td>
  1003. <td>(UTC - 09:30) Marquesas Islands</td>
  1004. </tr>
  1005. <tr class="row-even"><td>UM9</td>
  1006. <td>(UTC - 09:00) Alaska Standard Time, Gambier Islands</td>
  1007. </tr>
  1008. <tr class="row-odd"><td>UM8</td>
  1009. <td>(UTC - 08:00) Pacific Standard Time, Clipperton Island</td>
  1010. </tr>
  1011. <tr class="row-even"><td>UM7</td>
  1012. <td>(UTC - 07:00) Mountain Standard Time</td>
  1013. </tr>
  1014. <tr class="row-odd"><td>UM6</td>
  1015. <td>(UTC - 06:00) Central Standard Time</td>
  1016. </tr>
  1017. <tr class="row-even"><td>UM5</td>
  1018. <td>(UTC - 05:00) Eastern Standard Time, Western Caribbean</td>
  1019. </tr>
  1020. <tr class="row-odd"><td>UM45</td>
  1021. <td>(UTC - 04:30) Venezuelan Standard Time</td>
  1022. </tr>
  1023. <tr class="row-even"><td>UM4</td>
  1024. <td>(UTC - 04:00) Atlantic Standard Time, Eastern Caribbean</td>
  1025. </tr>
  1026. <tr class="row-odd"><td>UM35</td>
  1027. <td>(UTC - 03:30) Newfoundland Standard Time</td>
  1028. </tr>
  1029. <tr class="row-even"><td>UM3</td>
  1030. <td>(UTC - 03:00) Argentina, Brazil, French Guiana, Uruguay</td>
  1031. </tr>
  1032. <tr class="row-odd"><td>UM2</td>
  1033. <td>(UTC - 02:00) South Georgia/South Sandwich Islands</td>
  1034. </tr>
  1035. <tr class="row-even"><td>UM1</td>
  1036. <td>(UTC -1:00) Azores, Cape Verde Islands</td>
  1037. </tr>
  1038. <tr class="row-odd"><td>UTC</td>
  1039. <td>(UTC) Greenwich Mean Time, Western European Time</td>
  1040. </tr>
  1041. <tr class="row-even"><td>UP1</td>
  1042. <td>(UTC +1:00) Central European Time, West Africa Time</td>
  1043. </tr>
  1044. <tr class="row-odd"><td>UP2</td>
  1045. <td>(UTC +2:00) Central Africa Time, Eastern European Time</td>
  1046. </tr>
  1047. <tr class="row-even"><td>UP3</td>
  1048. <td>(UTC +3:00) Moscow Time, East Africa Time</td>
  1049. </tr>
  1050. <tr class="row-odd"><td>UP35</td>
  1051. <td>(UTC +3:30) Iran Standard Time</td>
  1052. </tr>
  1053. <tr class="row-even"><td>UP4</td>
  1054. <td>(UTC +4:00) Azerbaijan Standard Time, Samara Time</td>
  1055. </tr>
  1056. <tr class="row-odd"><td>UP45</td>
  1057. <td>(UTC +4:30) Afghanistan</td>
  1058. </tr>
  1059. <tr class="row-even"><td>UP5</td>
  1060. <td>(UTC +5:00) Pakistan Standard Time, Yekaterinburg Time</td>
  1061. </tr>
  1062. <tr class="row-odd"><td>UP55</td>
  1063. <td>(UTC +5:30) Indian Standard Time, Sri Lanka Time</td>
  1064. </tr>
  1065. <tr class="row-even"><td>UP575</td>
  1066. <td>(UTC +5:45) Nepal Time</td>
  1067. </tr>
  1068. <tr class="row-odd"><td>UP6</td>
  1069. <td>(UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time</td>
  1070. </tr>
  1071. <tr class="row-even"><td>UP65</td>
  1072. <td>(UTC +6:30) Cocos Islands, Myanmar</td>
  1073. </tr>
  1074. <tr class="row-odd"><td>UP7</td>
  1075. <td>(UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam</td>
  1076. </tr>
  1077. <tr class="row-even"><td>UP8</td>
  1078. <td>(UTC +8:00) Australian Western Standard Time, Beijing Time</td>
  1079. </tr>
  1080. <tr class="row-odd"><td>UP875</td>
  1081. <td>(UTC +8:45) Australian Central Western Standard Time</td>
  1082. </tr>
  1083. <tr class="row-even"><td>UP9</td>
  1084. <td>(UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk</td>
  1085. </tr>
  1086. <tr class="row-odd"><td>UP95</td>
  1087. <td>(UTC +9:30) Australian Central Standard Time</td>
  1088. </tr>
  1089. <tr class="row-even"><td>UP10</td>
  1090. <td>(UTC +10:00) Australian Eastern Standard Time, Vladivostok Time</td>
  1091. </tr>
  1092. <tr class="row-odd"><td>UP105</td>
  1093. <td>(UTC +10:30) Lord Howe Island</td>
  1094. </tr>
  1095. <tr class="row-even"><td>UP11</td>
  1096. <td>(UTC +11:00) Srednekolymsk Time, Solomon Islands, Vanuatu</td>
  1097. </tr>
  1098. <tr class="row-odd"><td>UP115</td>
  1099. <td>(UTC +11:30) Norfolk Island</td>
  1100. </tr>
  1101. <tr class="row-even"><td>UP12</td>
  1102. <td>(UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand</td>
  1103. </tr>
  1104. <tr class="row-odd"><td>UP1275</td>
  1105. <td>(UTC +12:45) Chatham Islands Standard Time</td>
  1106. </tr>
  1107. <tr class="row-even"><td>UP13</td>
  1108. <td>(UTC +13:00) Phoenix Islands Time, Tonga</td>
  1109. </tr>
  1110. <tr class="row-odd"><td>UP14</td>
  1111. <td>(UTC +14:00) Line Islands</td>
  1112. </tr>
  1113. </tbody>
  1114. </table>
  1115. </div>
  1116. </div>
  1117. </div>
  1118. <footer>
  1119. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  1120. <a href="directory_helper.html" class="btn btn-neutral float-right" title="Directory Helper">Next <span class="fa fa-arrow-circle-right"></span></a>
  1121. <a href="cookie_helper.html" class="btn btn-neutral" title="Cookie Helper"><span class="fa fa-arrow-circle-left"></span> Previous</a>
  1122. </div>
  1123. <hr/>
  1124. <div role="contentinfo">
  1125. <p>
  1126. &copy; Copyright 2014 - 2019, British Columbia Institute of Technology.
  1127. Last updated on Sep 19, 2019.
  1128. </p>
  1129. </div>
  1130. Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
  1131. </footer>
  1132. </div>
  1133. </div>
  1134. </section>
  1135. </div>
  1136. <script type="text/javascript">
  1137. var DOCUMENTATION_OPTIONS = {
  1138. URL_ROOT:'../',
  1139. VERSION:'3.1.11',
  1140. COLLAPSE_INDEX:false,
  1141. FILE_SUFFIX:'.html',
  1142. HAS_SOURCE: false
  1143. };
  1144. </script>
  1145. <script type="text/javascript" src="../_static/jquery.js"></script>
  1146. <script type="text/javascript" src="../_static/underscore.js"></script>
  1147. <script type="text/javascript" src="../_static/doctools.js"></script>
  1148. <script type="text/javascript" src="../_static/js/theme.js"></script>
  1149. <script type="text/javascript">
  1150. jQuery(function () {
  1151. SphinxRtdTheme.StickyNav.enable();
  1152. });
  1153. </script>
  1154. </body>
  1155. </html>