bidateformat.html

来自「ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.」· HTML 代码 · 共 380 行

HTML
380
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--Generated using api.website.xsl version 2003-07-17--><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"><title>BiDateFormat</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript">				function showDerivedClasses() {					var ul = document.getElementById("api-derived-classes");					var lis = ul.childNodes;					var l = lis.length;					for (var i = 1; i < l; i++)						lis[i].style.display = "";					lis[0].style.display = "none";				}			</script></head><body><h1 id="BiDateFormat">BiDateFormat</h1><p>This class is used to format and parse dates. It is based on the Java class <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a>.</p><p>This class extends		<code><a href="BiObject.html">BiObject</a></code>		and therefore all methods and fields available for		<code><a href="BiObject.html">BiObject</a></code>		are also available for <code>BiDateFormat</code>.</p><ul class="partial-class-tree"><li><code><a href="BiObject.html">BiObject</a></code><ul><li><code>BiDateFormat</code><ul id="api-derived-classes"></ul></li></ul></li></ul><h2>Constructor</h2><p><code>	new BiDateFormat(<span class="methodArgument">sPattern</span> [, <span class="methodArgument">sLanguage</span>])</code></p><h3>Parameters</h3><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sPattern</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>A pattern describing the date format.</td></tr><tr><td><code>sLanguage</code></td><td><code class="type">String</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>Optional string describing the locale</td></tr></tbody></table><h2>Properties</h2><table><thead><tr><td>Name</td><td>Type</td><td class="get-header">get</td><td class="set-header">set</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="dateFormatSymbols"></a><code>dateFormatSymbols</code></td><td><code class="type">				<code><a href="BiDateFormatSymbols.html">BiDateFormatSymbols</a></code>			</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The date format symbols used to define how to parse and format strings and dates</td></tr><tr><td><a name="lenient"></a><code>lenient</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>When this is <code>true</code> parsing will try to parse the string even though it does not correctly match the given pattern. For example it will try to use the Javascript Date parse method.</td></tr><tr><td><a name="localizedPattern"></a><code>localizedPattern</code></td><td><code class="type">String</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The pattern using localized pattern characters</td></tr><tr><td><a name="pattern"></a><code>pattern</code></td><td><code class="type">String</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The pattern to use when formatting and parsing</td></tr></tbody></table><h2>Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#format">format</a></code></td><td>This takes a date object and outputs a string formatted according to the provided <code><a href="#pattern">pattern</a></code>			</td></tr><tr><td><code><a href="#parse">parse</a></code></td><td>This takes a string describing the date and uses the current pattern to parse it to javascript date object. If <code><a href="#lenient">lenient</a></code> is <code>true</code> this will also try to parse the string even if it does not match the pattern.<br>								<br>				 If this fails an exception will be thrown.</td></tr></tbody></table><h2>Events</h2><p>None.</p><h2>Static Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#getDateInstance">getDateInstance</a></code></td><td>Creates a new<code><a href="BiDateFormat.html">BiDateFormat</a></code> object that uses a date pattern.</td></tr><tr><td><code><a href="#getDateTimeInstance">getDateTimeInstance</a></code></td><td>Creates a new<code><a href="BiDateFormat.html">BiDateFormat</a></code> object that uses a date time pattern.</td></tr><tr><td><code><a href="#getTimeInstance">getTimeInstance</a></code></td><td>Creates a new<code><a href="BiDateFormat.html">BiDateFormat</a></code> object that uses a time pattern.</td></tr></tbody></table><h2>Static Fields</h2><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>LONG</code></td><td><code class="type">String</code></td><td>Constant for long date format pattern</td></tr><tr><td><code>MEDIUM</code></td><td><code class="type">String</code></td><td>Constant for medium date format pattern</td></tr><tr><td><code>SHORT</code></td><td><code class="type">String</code></td><td>Constant for short date format pattern</td></tr></tbody></table><h2>Remarks</h2><p>Some limitations compared to the java class apply. For example 			where Java uses a Locale class Bindows uses a string.<br>				<br>		             The formatting and parsing of the timezone ('z') are limited to             the following format: "GMT-23:59".<br>				<br>		             'w' (week in year), 'W' (week in month) and 'D' (day in year) are             not supported.</p><h2>Method Details</h2><h3><a name="format"></a>format</h3><p>This takes a date object and outputs a string formatted according to the provided <code><a href="#pattern">pattern</a></code>			</p><h4>Syntax</h4><pre class="method-syntax">object.format(<span class="methodArgument">oDate</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oDate</code></td><td><code class="type">Date</code></td><td class="optional-column"></td><td></td><td>The date to format</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">String</code></p><h3><a name="parse"></a>parse</h3><p>This takes a string describing the date and uses the current pattern to parse it to javascript date object. If <code><a href="#lenient">lenient</a></code> is <code>true</code> this will also try to parse the string even if it does not match the pattern.<br>								<br>				 If this fails an exception will be thrown.</p><h4>Syntax</h4><pre class="method-syntax">object.parse(<span class="methodArgument">sDate</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sDate</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>The string describing the date</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Date</code></p><h2>Static Method Details</h2><h3><a name="getDateInstance"></a>getDateInstance</h3><p>Creates a new<code><a href="BiDateFormat.html">BiDateFormat</a></code> object that uses a date pattern.</p><h4>Syntax</h4><pre class="method-syntax">BiDateFormat.getDateInstance(<span class="methodArgument">sType</span> [, <span class="methodArgument">sLanguage</span>])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sType</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>Whether to use a short, medium or long date pattern</td></tr><tr><td><code>sLanguage</code></td><td><code class="type">String</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>Optional string identifying the locale.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">					<code><a href="BiDateFormat.html">BiDateFormat</a></code>				</code></p><h3><a name="getDateTimeInstance"></a>getDateTimeInstance</h3><p>Creates a new<code><a href="BiDateFormat.html">BiDateFormat</a></code> object that uses a date time pattern.</p><h4>Syntax</h4><pre class="method-syntax">BiDateFormat.getDateTimeInstance(<span class="methodArgument">sType</span> [, <span class="methodArgument">sLanguage</span>])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sType</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>Whether to use a short, medium or long date time pattern</td></tr><tr><td><code>sLanguage</code></td><td><code class="type">String</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>Optional string identifying the locale.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">					<code><a href="BiDateFormat.html">BiDateFormat</a></code>				</code></p><h3><a name="getTimeInstance"></a>getTimeInstance</h3><p>Creates a new<code><a href="BiDateFormat.html">BiDateFormat</a></code> object that uses a time pattern.</p><h4>Syntax</h4><pre class="method-syntax">BiDateFormat.getTimeInstance(<span class="methodArgument">sType</span> [, <span class="methodArgument">sLanguage</span>])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sType</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>Whether to use a short, medium or long time pattern</td></tr><tr><td><code>sLanguage</code></td><td><code class="type">String</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>Optional string identifying the locale.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">					<code><a href="BiDateFormat.html">BiDateFormat</a></code>				</code></p></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?