index.html 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Adding a Timepicker to jQuery UI Datepicker</title>
  6. <meta name="Description" content="jQuery Timepicker Addon. Add a timepicker to your jQuery UI Datepicker. With options to show only time, format time, and much more." />
  7. <meta name="Keywords" content="jQuery, UI, datepicker, timepicker, datetime, time, format" />
  8. <style type="text/css">
  9. body,img,p,h1,h2,h3,h4,h5,h6,form,table,td,ul,ol,li,dl,dt,dd,pre,blockquote,fieldset,label{
  10. margin:0;
  11. padding:0;
  12. border:0;
  13. }
  14. body{ background-color: #777; border-top: solid 10px #7b94b2; font: 90% Arial, Helvetica, sans-serif; padding: 20px; }
  15. h1,h2,h3{ margin: 10px 0; }
  16. h1{}
  17. h2{ color: #f66; }
  18. h3{ color: #6b84a2; }
  19. p{ margin: 10px 0; }
  20. a{ color: #7b94b2; }
  21. ul,ol{ margin: 10px 0 10px 40px; }
  22. li{ margin: 4px 0; }
  23. dl.defs{ margin: 10px 0 10px 40px; }
  24. dl.defs dt{ font-weight: bold; line-height: 20px; margin: 10px 0 0 0; }
  25. dl.defs dd{ margin: -20px 0 10px 160px; padding-bottom: 10px; border-bottom: solid 1px #eee;}
  26. pre{ font-size: 12px; line-height: 16px; padding: 5px 5px 5px 10px; margin: 10px 0; background-color: #e4f4d4; border-left: solid 5px #9EC45F; overflow: auto; tab-size: 4; -moz-tab-size: 4; -o-tab-size: 4; -webkit-tab-size: 4; }
  27. .wrapper{ background-color: #ffffff; width: 800px; border: solid 1px #eeeeee; padding: 20px; margin: 0 auto; }
  28. #tabs{ margin: 20px -20px; border: none; }
  29. #tabs, #ui-datepicker-div, .ui-datepicker{ font-size: 85%; }
  30. .clear{ clear: both; }
  31. .example-container{ background-color: #f4f4f4; border-bottom: solid 2px #777777; margin: 0 0 20px 40px; padding: 20px; }
  32. .example-container input{ border: solid 1px #aaa; padding: 4px; width: 175px; }
  33. .ebook{}
  34. .ebook img.ebookimg{ float: left; margin: 0 15px 15px 0; width: 100px; }
  35. .ebook .buyp a iframe{ margin-bottom: -5px; }
  36. </style>
  37. <link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css" />
  38. <link rel="stylesheet" media="all" type="text/css" href="jquery-ui-timepicker-addon.css" />
  39. </head>
  40. <body>
  41. <div class="wrapper">
  42. <h1>Adding a Timepicker to jQuery UI Datepicker</h1>
  43. <p>The timepicker addon adds a timepicker to jQuery UI Datepicker, thus the datepicker and slider components (jQueryUI) are required for using any of these. In addition all datepicker options are still available through the timepicker addon.</p>
  44. <p>If you are interested in contributing to Timepicker Addon please <a href="http://github.com/trentrichardson/jQuery-Timepicker-Addon" title="Check out Timepicker on GitHub">check it out on GitHub</a>. If you do make additions please keep in mind I enjoy tabs over spaces,.. But contributions are welcome in any form.</p>
  45. <p><a href="http://trentrichardson.com" title="Back to Blog">Back to Blog</a> or <a href="http://twitter.com/practicalweb" title="Follow Me on Twitter">Follow on Twitter</a></p>
  46. <a href="http://carbounce.com" title="Car Bounce" style="float: right;display: inline-block;width:380px;padding: 10px;background-color: #fbfbfb;border: dotted 4px #e8e8e8;color: #9EC45F;font-size: 16px;text-decoration:none;letter-spacing:1px;"><img src="http://carbounce.com/img/logo_small.png" alt="Car Bounce" align="left" style="margin-right: 20px;"/>Try my new app to keep you informed of your car's financing status and value.</a>
  47. <h2>Donation</h2>
  48. <p>Has this Timepicker Addon been helpful to you?</p>
  49. <div class="donation">
  50. <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  51. <input type="hidden" name="cmd" value="_s-xclick">
  52. <input type="hidden" name="hosted_button_id" value="C2QQHR7JQGD28">
  53. <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  54. <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
  55. </form>
  56. </div>
  57. <div id="tabs">
  58. <ul>
  59. <li><a href="#tp-getting-started" title="Getting Started">Getting Started</a></li>
  60. <li><a href="#tp-options" title="Options">Options</a></li>
  61. <li><a href="#tp-formatting" title="Examples">Formatting</a></li>
  62. <li><a href="#tp-localization" title="Examples">Localization</a></li>
  63. <li><a href="#tp-examples" title="Examples">Examples</a></li>
  64. </ul>
  65. <!-- ############################################################################# -->
  66. <!-- Getting Started
  67. <!-- ############################################################################# -->
  68. <div id="tp-getting-started">
  69. <h2>Getting Started</h2>
  70. <h3>Highly Recommended</h3>
  71. <h4>Handling Time eBook</h4>
  72. <div class="ebook">
  73. <p>Check out the <a href="http://trentrichardson.com/ebooks/handling-time/" title="Handling Time eBook">Handling Time eBook</a> to learn from the basic setup to advanced i18n usage, and from client's javascript to the server's database.</p>
  74. <a href="http://trentrichardson.com/ebooks/handling-time/" title="Handling Time eBook"><img src="http://trentrichardson.com/wp-content/uploads/2013/04/time-book-titlepage.jpg" alt="Handling Time eBook" style="float:left;width:100px;margin:0 15px 15px 0;" /></a>
  75. <p class="buyp"><a href="https://sellfy.com/p/8gxZ" id="8gxZ" class="sellfy-buy-button">buy</a> eBook + Example code</p>
  76. <p class="buyp"><a href="https://sellfy.com/p/LvAG" id="LvAG" class="sellfy-buy-button">buy</a> eBook</p>
  77. <div class="clear"></div>
  78. </div>
  79. <h4>Subscribe to Blog and Twitter</h4>
  80. <p><a href="http://trentrichardson.com" title="Subscribe to TrentRichardson.com via email">Subscribe to my blog via email</a> and follow <a href="http://twitter.com/practicalweb" title="Follow Me on Twitter">@PracticalWeb</a> on Twitter. I post for nearly every new version, so you know about updates.</p>
  81. <div class="clear"></div>
  82. <br />
  83. <h3>Download</h3>
  84. <p><a href="jquery-ui-timepicker-addon.js" title="Download Timepicker Addon">Download Timepicker Addon</a> and the <a href="jquery-ui-timepicker-addon.css" title="Download CSS">required CSS</a>.</p>
  85. <p><a href="http://github.com/trentrichardson/jQuery-Timepicker-Addon" title="Check out Timepicker on GitHub">Download/Contribute on GitHub</a> (Need the entire repo? Find a bug? See if its fixed here)</p>
  86. <p>If you prefer a hosted CDN there are a couple available: <a href="http://cdnjs.com/libraries/jquery-ui-timepicker-addon" title="Timepicker on CDNJS">CDNJS</a>, <a href="http://www.jsdelivr.com/#!jquery.ui.timepicker.addon" title="Timepicker on jsDelivr">jsDelivr</a>.</p>
  87. <br />
  88. <h3>Requirements</h3>
  89. <p>You also need to include jQuery and jQuery UI with datepicker and slider wigits. You should include them in your page in the following order:</p>
  90. <ol>
  91. <li>jQuery</li>
  92. <li>jQueryUI (with datepicker and slider wigits)</li>
  93. <li>Timepicker</li>
  94. </ol>
  95. <br />
  96. <h3>Version</h3>
  97. <p>Version 1.5.5</p>
  98. <p>Last updated on 2015-05-24</p>
  99. <p>jQuery Timepicker Addon is currently available for use in all personal or commercial projects under the MIT license.</p>
  100. <p><a href="http://trentrichardson.com/Impromptu/MIT-LICENSE.txt" title="MIT License">MIT License</a></p>
  101. </div>
  102. <!-- ############################################################################# -->
  103. <!-- Options
  104. <!-- ############################################################################# -->
  105. <div id="tp-options">
  106. <h2>Options</h2>
  107. <p>The timepicker does inherit all options from datepicker. However, there are many options that are shared by them both, and many timepicker only options:</p>
  108. <h3>Localization Options</h3>
  109. <dl class="defs">
  110. <dt>currentText</dt>
  111. <dd><em>Default: "Now", A Localization Setting</em> - Text for the Now button.</dd>
  112. <dt>closeText</dt>
  113. <dd><em>Default: "Done", A Localization Setting</em> - Text for the Close button.</dd>
  114. <dt>amNames</dt>
  115. <dd><em>Default: ['AM', 'A'], A Localization Setting</em> - Array of strings to try and parse against to determine AM.</dd>
  116. <dt>pmNames</dt>
  117. <dd><em>Default: ['PM', 'P'], A Localization Setting</em> - Array of strings to try and parse against to determine PM.</dd>
  118. <dt>timeFormat</dt>
  119. <dd><em>Default: "HH:mm", A Localization Setting</em> - String of format tokens to be replaced with the time. <a href="#tp-formatting" title="Formatting" onclick="$('#tabs').tabs('select',2);">See Formatting</a>.</dd>
  120. <dt>timeSuffix</dt>
  121. <dd><em>Default: "", A Localization Setting</em> - String to place after the formatted time.</dd>
  122. <dt>timeOnlyTitle</dt>
  123. <dd><em>Default: "Choose Time", A Localization Setting</em> - Title of the wigit when using only timepicker.</dd>
  124. <dt>timeText</dt>
  125. <dd><em>Default: "Time", A Localization Setting</em> - Label used within timepicker for the formatted time.</dd>
  126. <dt>hourText</dt>
  127. <dd><em>Default: "Hour", A Localization Setting</em> - Label used to identify the hour slider.</dd>
  128. <dt>minuteText</dt>
  129. <dd><em>Default: "Minute", A Localization Setting</em> - Label used to identify the minute slider.</dd>
  130. <dt>secondText</dt>
  131. <dd><em>Default: "Second", A Localization Setting</em> - Label used to identify the second slider.</dd>
  132. <dt>millisecText</dt>
  133. <dd><em>Default: "Millisecond", A Localization Setting</em> - Label used to identify the millisecond slider.</dd>
  134. <dt>microsecText</dt>
  135. <dd><em>Default: "Microsecond", A Localization Setting</em> - Label used to identify the microsecond slider.</dd>
  136. <dt>timezoneText</dt>
  137. <dd><em>Default: "Timezone", A Localization Setting</em> - Label used to identify the timezone slider.</dd>
  138. <dt>isRTL</dt>
  139. <dd><em>Default: false, A Localization Setting</em> - Right to Left support.</dd>
  140. </dl>
  141. <h3>Alt Field Options</h3>
  142. <dl class="defs">
  143. <dt>altFieldTimeOnly</dt>
  144. <dd><em>Default: true</em> - When altField is used from datepicker altField will only receive the formatted time and the original field only receives date.</dd>
  145. <dt>altSeparator</dt>
  146. <dd><em>Default: (separator option)</em> - String placed between formatted date and formatted time in the altField.</dd>
  147. <dt>altTimeSuffix</dt>
  148. <dd><em>Default: (timeSuffix option)</em> - String always placed after the formatted time in the altField.</dd>
  149. <dt>altTimeFormat</dt>
  150. <dd><em>Default: (timeFormat option)</em> - The time format to use with the altField.</dd>
  151. <dt>altRedirectFocus</dt>
  152. <dd><em>Default: true</em> - Whether to immediately focus the main field whenever the altField receives focus. Effective at construction time only, changing it later has no effect.</dd>
  153. </dl>
  154. <h3>Timezone Options</h3>
  155. <dl class="defs">
  156. <dt>timezoneList</dt>
  157. <dd><em>Default: [generated timezones]</em> - An array of timezones used to populate the timezone select. Can be an array of values or an array of objects: { label: "EDT", value: -240 }. The value should be the offset number in minutes. So "-0400" which is the format "-hhmm", would equate to -240 minutes.</dd>
  158. </dl>
  159. <h3>Time Field Options</h3>
  160. <dl class="defs">
  161. <dt>controlType</dt>
  162. <dd><em>Default: 'slider'</em> - Whether to use 'slider' or 'select'. If 'slider' is unavailable through jQueryUI, 'select' will be used. For advanced usage you may pass an object which implements "create", "options", "value" methods to use controls other than sliders or selects. See the _controls property in the source code for more details.
  163. <pre>{
  164. create: function(tp_inst, obj, unit, val, min, max, step){
  165. // generate whatever controls you want here, just return obj
  166. },
  167. options: function(tp_inst, obj, unit, opts, val){
  168. // if val==undefined return the value, else return obj
  169. },
  170. value: function(tp_inst, obj, unit, val){
  171. // if val==undefined return the value, else return obj
  172. }
  173. }</pre>
  174. </dd>
  175. <dt>showHour</dt>
  176. <dd><em>Default: null</em> - Whether to show the hour control. The default of null will use detection from timeFormat.</dd>
  177. <dt>showMinute</dt>
  178. <dd><em>Default: null</em> - Whether to show the minute control. The default of null will use detection from timeFormat.</dd>
  179. <dt>showSecond</dt>
  180. <dd><em>Default: null</em> - Whether to show the second control. The default of null will use detection from timeFormat.</dd>
  181. <dt>showMillisec</dt>
  182. <dd><em>Default: null</em> - Whether to show the millisecond control. The default of null will use detection from timeFormat.</dd>
  183. <dt>showMicrosec</dt>
  184. <dd><em>Default: null</em> - Whether to show the microsecond control. The default of null will use detection from timeFormat.</dd>
  185. <dt>showTimezone</dt>
  186. <dd><em>Default: null</em> - Whether to show the timezone select.</dd>
  187. <dt>showTime</dt>
  188. <dd><em>Default: true</em> - Whether to show the time selected within the datetimepicker.</dd>
  189. <dt>stepHour</dt>
  190. <dd><em>Default: 1</em> - Hours per step the slider makes.</dd>
  191. <dt>stepMinute</dt>
  192. <dd><em>Default: 1</em> - Minutes per step the slider makes.</dd>
  193. <dt>stepSecond</dt>
  194. <dd><em>Default: 1</em> - Seconds per step the slider makes.</dd>
  195. <dt>stepMillisec</dt>
  196. <dd><em>Default: 1</em> - Milliseconds per step the slider makes.</dd>
  197. <dt>stepMicrosec</dt>
  198. <dd><em>Default: 1</em> - Microseconds per step the slider makes.</dd>
  199. <dt>hour</dt>
  200. <dd><em>Default: 0</em> - Initial hour set.</dd>
  201. <dt>minute</dt>
  202. <dd><em>Default: 0</em> - Initial minute set.</dd>
  203. <dt>second</dt>
  204. <dd><em>Default: 0</em> - Initial second set.</dd>
  205. <dt>millisec</dt>
  206. <dd><em>Default: 0</em> - Initial millisecond set.</dd>
  207. <dt>microsec</dt>
  208. <dd><em>Default: 0</em> - Initial microsecond set. Note: Javascript's native Date object does not natively support microseconds. Timepicker adds ability to simply Date.setMicroseconds(m) and Date.getMicroseconds(). Date comparisons will not acknowledge microseconds. Use this only for display purposes.</dd>
  209. <dt>timezone</dt>
  210. <dd><em>Default: null</em> - Initial timezone set. This is the offset in minutes. If null the browser's local timezone will be used. If you're timezone is "-0400" you would use -240. For backwards compatibility you may pass "-0400", however the timezone is stored in minutes and more reliable.</dd>
  211. <dt>hourMin</dt>
  212. <dd><em>Default: 0</em> - The minimum hour allowed for all dates.</dd>
  213. <dt>minuteMin</dt>
  214. <dd><em>Default: 0</em> - The minimum minute allowed for all dates.</dd>
  215. <dt>secondMin</dt>
  216. <dd><em>Default: 0</em> - The minimum second allowed for all dates.</dd>
  217. <dt>millisecMin</dt>
  218. <dd><em>Default: 0</em> - The minimum millisecond allowed for all dates.</dd>
  219. <dt>microsecMin</dt>
  220. <dd><em>Default: 0</em> - The minimum microsecond allowed for all dates.</dd>
  221. <dt>hourMax</dt>
  222. <dd><em>Default: 23</em> - The maximum hour allowed for all dates.</dd>
  223. <dt>minuteMax</dt>
  224. <dd><em>Default: 59</em> - The maximum minute allowed for all dates.</dd>
  225. <dt>secondMax</dt>
  226. <dd><em>Default: 59</em> - The maximum second allowed for all dates.</dd>
  227. <dt>millisecMax</dt>
  228. <dd><em>Default: 999</em> - The maximum millisecond allowed for all dates.</dd>
  229. <dt>microsecMax</dt>
  230. <dd><em>Default: 999</em> - The maximum microsecond allowed for all dates.</dd>
  231. <dt>hourGrid</dt>
  232. <dd><em>Default: 0</em> - When greater than 0 a label grid will be generated under the slider. This number represents the units (in hours) between labels.</dd>
  233. <dt>minuteGrid</dt>
  234. <dd><em>Default: 0</em> - When greater than 0 a label grid will be generated under the slider. This number represents the units (in minutes) between labels.</dd>
  235. <dt>secondGrid</dt>
  236. <dd><em>Default: 0</em> - When greater than 0 a label grid will be genereated under the slider. This number represents the units (in seconds) between labels.</dd>
  237. <dt>millisecGrid</dt>
  238. <dd><em>Default: 0</em> - When greater than 0 a label grid will be genereated under the slider. This number represents the units (in milliseconds) between labels.</dd>
  239. <dt>microsecGrid</dt>
  240. <dd><em>Default: 0</em> - When greater than 0 a label grid will be genereated under the slider. This number represents the units (in microseconds) between labels.</dd>
  241. </dl>
  242. <h3>Other Options</h3>
  243. <dl class="defs">
  244. <dt>showButtonPanel</dt>
  245. <dd><em>Default: true</em> - Whether to show the button panel at the bottom. This is generally needed.</dd>
  246. <dt>timeOnly</dt>
  247. <dd><em>Default: false</em> - Hide the datepicker and only provide a time interface.</dd>
  248. <dt>timeOnlyShowDate</dt>
  249. <dd><em>Default: false</em> - Show the date and time in the input, but only allow the timepicker.</dd>
  250. <dt>afterInject</dt>
  251. <dd><em>Default: null</em> - Function to be called when the timepicker or selection control is injected or re-rendered. Called in the context of the timepicker instance.</dd>
  252. <dt>onSelect</dt>
  253. <dd><em>Default: null</em> - Function to be called when a date is chosen or time has changed (parameters: datetimeText, datepickerInstance).</dd>
  254. <dt>alwaysSetTime</dt>
  255. <dd><em>Default: true</em> - Always have a time set internally, even before user has chosen one.</dd>
  256. <dt>separator</dt>
  257. <dd><em>Default: " "</em> - When formatting the time this string is placed between the formatted date and formatted time.</dd>
  258. <dt>pickerTimeFormat</dt>
  259. <dd><em>Default: (timeFormat option)</em> - How to format the time displayed within the timepicker.</dd>
  260. <dt>pickerTimeSuffix</dt>
  261. <dd><em>Default: (timeSuffix option)</em> - String to place after the formatted time within the timepicker.</dd>
  262. <dt>showTimepicker</dt>
  263. <dd><em>Default: true</em> - Whether to show the timepicker within the datepicker.</dd>
  264. <dt>oneLine</dt>
  265. <dd><em>Default: false</em> - Try to show the time dropdowns all on one line. This should be used with controlType 'select' and as few units as possible.</dd>
  266. <dt>addSliderAccess</dt>
  267. <dd><em>Default: false</em> - Adds the <a href="http://trentrichardson.com/examples/jQuery-SliderAccess/" title="jQueryUI Slider Access Plugin">sliderAccess plugin</a> to sliders within timepicker</dd>
  268. <dt>sliderAccessArgs</dt>
  269. <dd><em>Default: null</em> - Object to pass to sliderAccess when used.</dd>
  270. <dt>defaultValue</dt>
  271. <dd><em>Default: null</em> - String of the default time value placed in the input on focus when the input is empty.</dd>
  272. <dt>minDateTime</dt>
  273. <dd><em>Default: null</em> - Date object of the minimum datetime allowed. Also available as minDate.</dd>
  274. <dt>maxDateTime</dt>
  275. <dd><em>Default: null</em> - Date object of the maximum datetime allowed. Also Available as maxDate.</dd>
  276. <dt>minTime</dt>
  277. <dd><em>Default: null</em> - String of the minimum time allowed. '8:00 am' will restrict to times after 8am</dd>
  278. <dt>maxTime</dt>
  279. <dd><em>Default: null</em> - String of the maximum time allowed. '8:00 pm' will restrict to times before 8pm</dd>
  280. <dt>parse</dt>
  281. <dd><em>Default: 'strict'</em> - How to parse the time string. Two methods are provided: 'strict' which must match the timeFormat exactly, and 'loose' which uses javascript's new Date(timeString) to guess the time. You may also pass in a function(timeFormat, timeString, options) to handle the parsing yourself, returning a simple object:
  282. <pre>{
  283. hour: 19,
  284. minute: 10,
  285. second: 23,
  286. millisec: 45,
  287. microsec: 23,
  288. timezone: '-0400'
  289. }</pre>
  290. </dd>
  291. </dl>
  292. </div>
  293. <!-- ############################################################################# -->
  294. <!-- Formatting
  295. <!-- ############################################################################# -->
  296. <div id="tp-formatting">
  297. <h2>Formatting Your Time</h2>
  298. <p>The default format is "HH:mm". To use 12 hour time use something similar to: "hh:mm tt". When both "t" and lower case "h" are present in the timeFormat, 12 hour time will be used.</p>
  299. <dl class="defs">
  300. <dt>H</dt><dd>Hour with no leading 0 (24 hour)</dd>
  301. <dt>HH</dt><dd>Hour with leading 0 (24 hour)</dd>
  302. <dt>h</dt><dd>Hour with no leading 0 (12 hour)</dd>
  303. <dt>hh</dt><dd>Hour with leading 0 (12 hour)</dd>
  304. <dt>m</dt><dd>Minute with no leading 0</dd>
  305. <dt>mm</dt><dd>Minute with leading 0</dd>
  306. <dt>s</dt><dd>Second with no leading 0</dd>
  307. <dt>ss</dt><dd>Second with leading 0</dd>
  308. <dt>l</dt><dd>Milliseconds always with leading 0</dd>
  309. <dt>c</dt><dd>Microseconds always with leading 0</dd>
  310. <dt>t</dt><dd>a or p for AM/PM</dd>
  311. <dt>T</dt><dd>A or P for AM/PM</dd>
  312. <dt>tt</dt><dd>am or pm for AM/PM</dd>
  313. <dt>TT</dt><dd>AM or PM for AM/PM</dd>
  314. <dt>z</dt><dd>Timezone as defined by timezoneList</dd>
  315. <dt>Z</dt><dd>Timezone in Iso 8601 format (+04:45)</dd>
  316. <dt>'...'</dt><dd>Literal text (Uses single quotes)</dd>
  317. </dl>
  318. <p>Formats are used in the following ways:</p>
  319. <ul>
  320. <li>timeFormat option</li>
  321. <li>altTimeFormat option</li>
  322. <li>pickerTimeFormat option</li>
  323. <li>$.datepicker.formatTime(format, timeObj, options) utility method</li>
  324. <li>$.datepicker.parseTime(format, timeStr, options) utility method</li>
  325. </ul>
  326. <p>For help with formatting the date portion, visit the datepicker documentation for <a href="http://docs.jquery.com/UI/Datepicker/formatDate" title="jQuery UI Datepicker Formatting">formatting dates</a>.</p>
  327. </div>
  328. <!-- ############################################################################# -->
  329. <!-- Localization
  330. <!-- ############################################################################# -->
  331. <div id="tp-localization">
  332. <h2>Working with Localizations</h2>
  333. <p>Timepicker comes with many translations and localizations, thanks to all the contributors. They can be found in the i18n folder in the git repo.</p>
  334. <p>The quick and cheap way to use localizations is to pass in options to a timepicker instance:</p>
  335. <pre>$('#example123').timepicker({
  336. timeOnlyTitle: 'Выберите время',
  337. timeText: 'Время',
  338. hourText: 'Часы',
  339. minuteText: 'Минуты',
  340. secondText: 'Секунды',
  341. currentText: 'Сейчас',
  342. closeText: 'Закрыть'
  343. });
  344. </pre>
  345. <p>However, if you plan to use timepicker extensively you will need to include (build your own) localization. It is simply assigning those same variables to an object.</p>
  346. <p>As you see in the example below we maintain a separate object for timepicker. This way we aren't bound to any future changes within datepicker.</p>
  347. <pre>$.datepicker.regional['ru'] = {
  348. closeText: 'Закрыть',
  349. prevText: '&#x3c;Пред',
  350. nextText: 'След&#x3e;',
  351. currentText: 'Сегодня',
  352. monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
  353. 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
  354. monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
  355. 'Июл','Авг','Сен','Окт','Ноя','Дек'],
  356. dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
  357. dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
  358. dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
  359. weekHeader: 'Не',
  360. dateFormat: 'dd.mm.yy',
  361. firstDay: 1,
  362. isRTL: false,
  363. showMonthAfterYear: false,
  364. yearSuffix: ''
  365. };
  366. $.datepicker.setDefaults($.datepicker.regional['ru']);
  367. $.timepicker.regional['ru'] = {
  368. timeOnlyTitle: 'Выберите время',
  369. timeText: 'Время',
  370. hourText: 'Часы',
  371. minuteText: 'Минуты',
  372. secondText: 'Секунды',
  373. millisecText: 'Миллисекунды',
  374. timezoneText: 'Часовой пояс',
  375. currentText: 'Сейчас',
  376. closeText: 'Закрыть',
  377. timeFormat: 'HH:mm',
  378. amNames: ['AM', 'A'],
  379. pmNames: ['PM', 'P'],
  380. isRTL: false
  381. };
  382. $.timepicker.setDefaults($.timepicker.regional['ru']);
  383. </pre>
  384. <p>Now all you have to do is call timepicker and the Russian localization is used. Generally you only need to include the localization file, it will setDefaults() for you.</p>
  385. <p>As of version 1.4.5 a combined file of all localizations available is included. This file DOES NOT call setDefaults(), so you will need to pass, or merge with your options.</p>
  386. <pre>$('#example123').timepicker($.timepicker.regional['ru']);
  387. </pre>
  388. <p>Localization files for datepicker are typically available in your jQueryUI downloads.</p>
  389. </div>
  390. <!-- ############################################################################# -->
  391. <!-- Examples
  392. <!-- ############################################################################# -->
  393. <div id="tp-examples">
  394. <h2>Examples</h2>
  395. <ul>
  396. <li><a href="#basic_examples" title="Basic Initializations">Basic Initializations</a></li>
  397. <li><a href="#timezone_examples" title="Using Timezones">Using Timezones</a></li>
  398. <li><a href="#slider_examples" title="Slider Modifications">Slider Modifications</a></li>
  399. <li><a href="#alt_examples" title="Alternate Field">Alternate Fields</a></li>
  400. <li><a href="#rest_examples" title="Time Restraints">Time Restraints</a></li>
  401. <li><a href="#range_examples" title="Time Ranges">Time Ranges</a></li>
  402. <li><a href="#utility_examples" title="Utilities">Utilities</a></li>
  403. </ul>
  404. <h3 id="basic_examples">Basic Initializations</h3>
  405. <!-- ============= example -->
  406. <div class="example-container">
  407. <p>Add a simple datetimepicker to jQuery UI's datepicker</p>
  408. <div>
  409. <input type="text" name="basic_example_1" id="basic_example_1" value="" />
  410. </div>
  411. <pre>
  412. $('#basic_example_1').datetimepicker();
  413. </pre>
  414. </div>
  415. <!-- ============= example -->
  416. <div class="example-container">
  417. <p>Add only a timepicker:</p>
  418. <div>
  419. <input type="text" name="basic_example_2" id="basic_example_2" value="" />
  420. </div>
  421. <pre>
  422. $('#basic_example_2').timepicker();
  423. </pre>
  424. </div>
  425. <!-- ============= example -->
  426. <div class="example-container">
  427. <p>Format the time:</p>
  428. <div>
  429. <input type="text" name="basic_example_3" id="basic_example_3" value="" />
  430. </div>
  431. <pre>
  432. $('#basic_example_3').datetimepicker({
  433. timeFormat: "hh:mm tt"
  434. });
  435. </pre>
  436. </div>
  437. <!-- ============= example -->
  438. <div class="example-container">
  439. <p>Timepicker comes with a collection of localization files and one combined file with all available localizations. $.timepicker.regional["your localization code here"] is a simple object with preset options:</p>
  440. <div>
  441. <input type="text" name="basic_example_4" id="basic_example_4" value="" />
  442. </div>
  443. <pre>
  444. $('#basic_example_4').timepicker(
  445. $.timepicker.regional['es']
  446. );
  447. </pre>
  448. </div>
  449. <h3 id="timezone_examples">Using Timezones</h3>
  450. <!-- ============= example -->
  451. <div class="example-container">
  452. <p>Simplest timezone usage:</p>
  453. <div>
  454. <input type="text" name="timezone_example_1" id="timezone_example_1" value="" />
  455. </div>
  456. <pre>
  457. $('#timezone_example_1').datetimepicker({
  458. timeFormat: 'hh:mm tt z'
  459. });
  460. </pre>
  461. </div>
  462. <!-- ============= example -->
  463. <div class="example-container">
  464. <p>Define your own timezone options:</p>
  465. <div>
  466. <input type="text" name="timezone_example_2" id="timezone_example_2" value="" />
  467. </div>
  468. <pre>
  469. $('#timezone_example_2').datetimepicker({
  470. timeFormat: 'HH:mm z',
  471. timezoneList: [
  472. { value: -300, label: 'Eastern'},
  473. { value: -360, label: 'Central' },
  474. { value: -420, label: 'Mountain' },
  475. { value: -480, label: 'Pacific' }
  476. ]
  477. });
  478. </pre>
  479. </div>
  480. <!-- ============= example -->
  481. <div class="example-container">
  482. <p>You may also use timezone string abbreviations for values. This should be used with caution. Computing accurate javascript Date objects may not be possible when trying to retrieve or set the date from timepicker (see setDate and getDate examples below). For simple input values however this should work.</p>
  483. <div>
  484. <input type="text" name="timezone_example_3" id="timezone_example_3" value="" />
  485. </div>
  486. <pre>
  487. $('#timezone_example_3').datetimepicker({
  488. timeFormat: 'HH:mm z',
  489. timezone: 'MT',
  490. timezoneList: [
  491. { value: 'ET', label: 'Eastern'},
  492. { value: 'CT', label: 'Central' },
  493. { value: 'MT', label: 'Mountain' },
  494. { value: 'PT', label: 'Pacific' }
  495. ]
  496. });
  497. </pre>
  498. </div>
  499. <h3 id="slider_examples">Slider Modifications</h3>
  500. <!-- ============= example -->
  501. <div class="example-container">
  502. <p>Add a grid to each slider:</p>
  503. <div>
  504. <input type="text" name="slider_example_1" id="slider_example_1" value="" />
  505. </div>
  506. <pre>
  507. $('#slider_example_1').timepicker({
  508. hourGrid: 4,
  509. minuteGrid: 10,
  510. timeFormat: 'hh:mm tt'
  511. });
  512. </pre>
  513. </div>
  514. <!-- ============= example -->
  515. <div class="example-container">
  516. <p>Set the interval step of sliders:</p>
  517. <div>
  518. <input type="text" name="slider_example_2" id="slider_example_2" value="" />
  519. </div>
  520. <pre>
  521. $('#slider_example_2').datetimepicker({
  522. timeFormat: 'HH:mm:ss',
  523. stepHour: 2,
  524. stepMinute: 10,
  525. stepSecond: 10
  526. });
  527. </pre>
  528. </div>
  529. <!-- ============= example -->
  530. <div class="example-container">
  531. <p>Add sliderAccess plugin for touch devices:</p>
  532. <div>
  533. <input type="text" name="slider_example_3" id="slider_example_3" value="" />
  534. </div>
  535. <pre>
  536. $('#slider_example_3').datetimepicker({
  537. addSliderAccess: true,
  538. sliderAccessArgs: { touchonly: false }
  539. });</pre>
  540. </div>
  541. <!-- ============= example -->
  542. <div class="example-container">
  543. <p>Use dropdowns instead of sliders. By default if slider is not available dropdowns will be used.</p>
  544. <div>
  545. <input type="text" name="slider_example_4" id="slider_example_4" value="" />
  546. </div>
  547. <pre>
  548. $('#slider_example_4').datetimepicker({
  549. controlType: 'select',
  550. timeFormat: 'hh:mm tt'
  551. });</pre>
  552. </div>
  553. <!-- ============= example -->
  554. <div class="example-container">
  555. <p>Uses one line dropdowns instead of sliders.</p>
  556. <div>
  557. <input type="text" name="slider_example_4andHalf" id="slider_example_4andHalf" value="" />
  558. </div>
  559. <pre>
  560. $('#slider_example_4andHalf').datetimepicker({
  561. controlType: 'select',
  562. oneLine: true,
  563. timeFormat: 'hh:mm tt'
  564. });</pre>
  565. </div>
  566. <!-- ============= example -->
  567. <div class="example-container">
  568. <p>Create your own control by implementing the create, options, and value methods. If you want to use your new control for all instances use the $.timepicker.setDefaults({controlType:myControl}). Here we implement jQueryUI's spinner control (jQueryUI 1.9+).</p>
  569. <div>
  570. <input type="text" name="slider_example_5" id="slider_example_5" value="" />
  571. </div>
  572. <pre>var myControl= {
  573. create: function(tp_inst, obj, unit, val, min, max, step){
  574. $('&lt;input class="ui-timepicker-input" value="'+val+'" style="width:50%"&gt;')
  575. .appendTo(obj)
  576. .spinner({
  577. min: min,
  578. max: max,
  579. step: step,
  580. change: function(e,ui){ // key events
  581. // don't call if api was used and not key press
  582. if(e.originalEvent !== undefined)
  583. tp_inst._onTimeChange();
  584. tp_inst._onSelectHandler();
  585. },
  586. spin: function(e,ui){ // spin events
  587. tp_inst.control.value(tp_inst, obj, unit, ui.value);
  588. tp_inst._onTimeChange();
  589. tp_inst._onSelectHandler();
  590. }
  591. });
  592. return obj;
  593. },
  594. options: function(tp_inst, obj, unit, opts, val){
  595. if(typeof(opts) == 'string' && val !== undefined)
  596. return obj.find('.ui-timepicker-input').spinner(opts, val);
  597. return obj.find('.ui-timepicker-input').spinner(opts);
  598. },
  599. value: function(tp_inst, obj, unit, val){
  600. if(val !== undefined)
  601. return obj.find('.ui-timepicker-input').spinner('value', val);
  602. return obj.find('.ui-timepicker-input').spinner('value');
  603. }
  604. };
  605. $('#slider_example_5').datetimepicker({
  606. controlType: myControl
  607. });</pre>
  608. </div>
  609. <h3 id="alt_examples">Alternate Fields</h3>
  610. <!-- ============= example -->
  611. <div class="example-container">
  612. <p>Alt field in the simplest form:</p>
  613. <div>
  614. <input type="text" name="alt_example_1" id="alt_example_1" value="09/15/2012" />
  615. <input type="text" name="alt_example_1_alt" id="alt_example_1_alt" value="10:15" />
  616. </div>
  617. <pre>
  618. $('#alt_example_1').datetimepicker({
  619. altField: "#alt_example_1_alt"
  620. });
  621. </pre>
  622. </div>
  623. <!-- ============= example -->
  624. <div class="example-container">
  625. <p>With datetime in both:</p>
  626. <div>
  627. <input type="text" name="alt_example_2" id="alt_example_2" value="" />
  628. <input type="text" name="alt_example_2_alt" id="alt_example_2_alt" value="" />
  629. </div>
  630. <pre>
  631. $('#alt_example_2').datetimepicker({
  632. altField: "#alt_example_2_alt",
  633. altFieldTimeOnly: false
  634. });
  635. </pre>
  636. </div>
  637. <!-- ============= example -->
  638. <div class="example-container">
  639. <p>Format the altField differently:</p>
  640. <div>
  641. <input type="text" name="alt_example_3" id="alt_example_3" value="" />
  642. <input type="text" name="alt_example_3_alt" id="alt_example_3_alt" value="" />
  643. </div>
  644. <pre>
  645. $('#alt_example_3').datetimepicker({
  646. altField: "#alt_example_3_alt",
  647. altFieldTimeOnly: false,
  648. altFormat: "yy-mm-dd",
  649. altTimeFormat: "h:m t",
  650. altSeparator: " @ "
  651. });
  652. </pre>
  653. </div>
  654. <!-- ============= example -->
  655. <div class="example-container">
  656. <p>With inline mode using altField:</p>
  657. <div>
  658. <input type="text" name="alt_example_4_alt" id="alt_example_4_alt" value="" />
  659. <span id="alt_example_4" ></span>
  660. </div>
  661. <pre>
  662. $('#alt_example_4').datetimepicker({
  663. altField: "#alt_example_4_alt",
  664. altFieldTimeOnly: false
  665. });
  666. </pre>
  667. </div>
  668. <h3 id="rest_examples">Time Restraints</h3>
  669. <!-- ============= example -->
  670. <div class="example-container">
  671. <p>Set the min/max hour of every date:</p>
  672. <div>
  673. <input type="text" name="rest_example_1" id="rest_example_1" value="" />
  674. </div>
  675. <pre>
  676. $('#rest_example_1').timepicker({
  677. hourMin: 8,
  678. hourMax: 16
  679. });
  680. </pre>
  681. </div>
  682. <!-- ============= example -->
  683. <div class="example-container">
  684. <p>Set the min/max date numerically:</p>
  685. <div>
  686. <input type="text" name="rest_example_2" id="rest_example_2" value="" />
  687. </div>
  688. <pre>
  689. $('#rest_example_2').datetimepicker({
  690. numberOfMonths: 2,
  691. minDate: 0,
  692. maxDate: 30
  693. });
  694. </pre>
  695. </div>
  696. <!-- ============= example -->
  697. <div class="example-container">
  698. <p>Set the min/max date and time with a Date object:</p>
  699. <div>
  700. <input type="text" name="rest_example_3" id="rest_example_3" value="" />
  701. </div>
  702. <pre>
  703. $('#rest_example_3').datetimepicker({
  704. minDate: new Date(2010, 11, 20, 8, 30),
  705. maxDate: new Date(2010, 11, 31, 17, 30)
  706. });
  707. </pre>
  708. </div>
  709. <h3 id="range_examples">Time Ranges</h3>
  710. <!-- ============= example -->
  711. <div class="example-container">
  712. <p>Restrict a start and end date by using onSelect and onClose events for more control over functionality:</p>
  713. <p>For more examples and advanced usage grab the <a href="http://trentrichardson.com/ebooks/handling-time/" title="Handling Time eBook">Handling Time eBook</a>.</p>
  714. <div>
  715. <input type="text" name="range_example_1_start" id="range_example_1_start" value="08/20/2014 09:22 -0400" />
  716. <input type="text" name="range_example_1_end" id="range_example_1_end" value="08/21/2014 08:00 -0400" />
  717. </div>
  718. <pre>
  719. var startDateTextBox = $('#range_example_1_start');
  720. var endDateTextBox = $('#range_example_1_end');
  721. startDateTextBox.datetimepicker({
  722. timeFormat: 'HH:mm z',
  723. onClose: function(dateText, inst) {
  724. if (endDateTextBox.val() != '') {
  725. var testStartDate = startDateTextBox.datetimepicker('getDate');
  726. var testEndDate = endDateTextBox.datetimepicker('getDate');
  727. if (testStartDate > testEndDate)
  728. endDateTextBox.datetimepicker('setDate', testStartDate);
  729. }
  730. else {
  731. endDateTextBox.val(dateText);
  732. }
  733. },
  734. onSelect: function (selectedDateTime){
  735. endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
  736. }
  737. });
  738. endDateTextBox.datetimepicker({
  739. timeFormat: 'HH:mm z',
  740. onClose: function(dateText, inst) {
  741. if (startDateTextBox.val() != '') {
  742. var testStartDate = startDateTextBox.datetimepicker('getDate');
  743. var testEndDate = endDateTextBox.datetimepicker('getDate');
  744. if (testStartDate > testEndDate)
  745. startDateTextBox.datetimepicker('setDate', testEndDate);
  746. }
  747. else {
  748. startDateTextBox.val(dateText);
  749. }
  750. },
  751. onSelect: function (selectedDateTime){
  752. startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
  753. }
  754. });
  755. </pre>
  756. </div>
  757. <!-- ============= example -->
  758. <div class="example-container">
  759. <p>Timepicker also includes some shortcut methods for ranges:</p>
  760. <div>
  761. <input type="text" name="range_example_2_start" id="range_example_2_start" value="" />
  762. <input type="text" name="range_example_2_end" id="range_example_2_end" value="" />
  763. </div>
  764. <pre>
  765. var startDateTextBox = $('#range_example_2_start');
  766. var endDateTextBox = $('#range_example_2_end');
  767. $.timepicker.datetimeRange(
  768. startDateTextBox,
  769. endDateTextBox,
  770. {
  771. minInterval: (1000*60*60), // 1hr
  772. dateFormat: 'dd M yy',
  773. timeFormat: 'HH:mm',
  774. start: {}, // start picker options
  775. end: {} // end picker options
  776. }
  777. );
  778. </pre>
  779. </div>
  780. <!-- ============= example -->
  781. <div class="example-container">
  782. <p>To use only times for a time range use $.timepicker.timeRange():</p>
  783. <div>
  784. <input type="text" name="range_example_3_start" id="range_example_3_start" value="09:16" />
  785. <input type="text" name="range_example_3_end" id="range_example_3_end" value="10:16" />
  786. </div>
  787. <pre>
  788. var startTimeTextBox = $('#range_example_3_start');
  789. var endTimeTextBox = $('#range_example_3_end');
  790. $.timepicker.timeRange(
  791. startTimeTextBox,
  792. endTimeTextBox,
  793. {
  794. minInterval: (1000*60*60), // 1hr
  795. timeFormat: 'HH:mm',
  796. start: {}, // start picker options
  797. end: {} // end picker options
  798. }
  799. );
  800. </pre>
  801. </div>
  802. <!-- ============= example -->
  803. <div class="example-container">
  804. <p>Even though this plugin focuses on datetime, it also provides a dateRange function:</p>
  805. <div>
  806. <input type="text" name="range_example_4_start" id="range_example_4_start" value="" />
  807. <input type="text" name="range_example_4_end" id="range_example_4_end" value="" />
  808. </div>
  809. <pre>
  810. var startDateTextBox = $('#range_example_4_start');
  811. var endDateTextBox = $('#range_example_4_end');
  812. $.timepicker.dateRange(
  813. startDateTextBox,
  814. endDateTextBox,
  815. {
  816. minInterval: (1000*60*60*24*4), // 4 days
  817. maxInterval: (1000*60*60*24*8), // 8 days
  818. start: {}, // start picker options
  819. end: {} // end picker options
  820. }
  821. );
  822. </pre>
  823. </div>
  824. <h3 id="utility_examples">Utilities</h3>
  825. <!-- ============= example -->
  826. <div class="example-container">
  827. <p>Get and Set Datetime with the getDate and setDate methods. This example uses timezone to demonstrate the timepicker regonizes the timezones and computes the offsets when getting and setting.</p>
  828. <div>
  829. <input type="text" name="utility_example_1" id="utility_example_1" value="" />
  830. <button id="utility_example_1_setdt" value="1">Set Datetime</button>
  831. <button id="utility_example_1_getdt" value="1">Get Datetime</button>
  832. </div>
  833. <pre>
  834. var ex13 = $('#utility_example_1');
  835. ex13.datetimepicker({
  836. timeFormat: 'hh:mm tt z',
  837. separator: ' @ ',
  838. showTimezone: true
  839. });
  840. $('#utility_example_1_setdt').click(function(){
  841. ex13.datetimepicker('setDate', (new Date()) );
  842. });
  843. $('#utility_example_1_getdt').click(function(){
  844. alert(ex13.datetimepicker('getDate'));
  845. });
  846. </pre>
  847. </div>
  848. <!-- ============= example -->
  849. <div class="example-container">
  850. <p>Use the utility function to format your own time. $.datepicker.formatTime(format, time, options)</p>
  851. <dl class="defs">
  852. <dt>format</dt><dd>required - string represenation of the time format to use</dd>
  853. <dt>time</dt><dd>required - hash: { hour, minute, second, millisecond, timezone }</dd>
  854. <dt>options</dt><dd>optional - hash of any options in regional translation (ampm, amNames, pmNames..)</dd>
  855. </dl>
  856. <p>Returns a time string in the specified format.</p>
  857. <div>
  858. <div id="utility_example_2"></div>
  859. </div>
  860. <pre>
  861. $('#utility_example_2').text(
  862. $.datepicker.formatTime('HH:mm z', { hour: 14, minute: 36, timezone: '+2000' }, {})
  863. );
  864. </pre>
  865. </div>
  866. <!-- ============= example -->
  867. <div class="example-container">
  868. <p>Use the utility function to parses a formatted time. $.datepicker.parseTime(format, timeString, options)</p>
  869. <dl class="defs">
  870. <dt>format</dt><dd>required - string represenation of the time format to use</dd>
  871. <dt>time</dt><dd>required - time string matching the format given in parameter 1</dd>
  872. <dt>options</dt><dd>optional - hash of any options in regional translation (ampm, amNames, pmNames..)</dd>
  873. </dl>
  874. <p>Returns an object with hours, minutes, seconds, milliseconds, timezone.</p>
  875. <div>
  876. <div id="utility_example_3"></div>
  877. </div>
  878. <pre>
  879. $('#utility_example_3').text(JSON.stringify(
  880. $.datepicker.parseTime('HH:mm:ss:l z', "14:36:21:765 +2000", {})
  881. ));
  882. </pre>
  883. </div>
  884. </div>
  885. </div>
  886. </div>
  887. <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
  888. <script type="text/javascript" src="http://code.jquery.com/ui/1.11.0/jquery-ui.min.js"></script>
  889. <script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
  890. <script type="text/javascript" src="i18n/jquery-ui-timepicker-addon-i18n.min.js"></script>
  891. <script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
  892. <script type="text/javascript">
  893. $(function(){
  894. $('#tabs').tabs();
  895. $('.example-container > pre').each(function(i){
  896. eval($(this).text());
  897. });
  898. });
  899. </script>
  900. <script type="text/javascript" src="https://sellfy.com/js/api_buttons.js"></script>
  901. <!--
  902. <script type="text/javascript">
  903. var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  904. document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  905. </script>
  906. <script type="text/javascript">
  907. try {
  908. var pageTracker = _gat._getTracker("UA-7602218-1");
  909. pageTracker._trackPageview();
  910. } catch(err) {}</script>
  911. -->
  912. </body>
  913. </html>