123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708 |
- <div class="body-wrap">
- <div class="top-tools">
- <a class="inner-link" href="#Date-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
- <a class="inner-link" href="#Date-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
- <a class="inner-link" href="#Date-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
- <a class="bookmark" href="../docs/?class=Date"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
- </div>
- <h1>Class Date</h1>
- <table cellspacing="0">
- <tr><td class="label">Package:</td><td class="hd-info">Global</td></tr>
- <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/Date.js" target="_blank">Date.js</a></td></tr>
- <tr><td class="label">Class:</td><td class="hd-info">Date</td></tr>
- <tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr>
- </table>
- <div class="description">
- The date parsing and format syntax is a subset of
- <a href="http://www.php.net/date">PHP's date() function</a>, and the formats that are
- supported will provide results equivalent to their PHP versions.
- The following is a list of all currently supported formats:
- <pre>Format Description Example returned values
- ------ ----------------------------------------------------------------------- -----------------------
- d Day of the month, 2 digits with leading zeros 01 to 31
- D A short textual representation of the day of the week Mon to Sun
- j Day of the month without leading zeros 1 to 31
- l A full textual representation of the day of the week Sunday to Saturday
- N ISO-8601 numeric representation of the day of the week 1 (for Monday) through 7 (for Sunday)
- S English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with j
- w Numeric representation of the day of the week 0 (for Sunday) to 6 (for Saturday)
- z The day of the year (starting from 0) 0 to 364 (365 in leap years)
- W ISO-8601 week number of year, weeks starting on Monday 01 to 53
- F A full textual representation of a month, such as January or March January to December
- m Numeric representation of a month, with leading zeros 01 to 12
- M A short textual representation of a month Jan to Dec
- n Numeric representation of a month, without leading zeros 1 to 12
- t Number of days in the given month 28 to 31
- L Whether it's a leap year 1 if it is a leap year, 0 otherwise.
- o ISO-8601 year number (identical to (Y), but if the ISO week number (W) Examples: 1998 or 2004
- belongs to the previous or next year, that year is used instead)
- Y A full numeric representation of a year, 4 digits Examples: 1999 or 2003
- y A two digit representation of a year Examples: 99 or 03
- a Lowercase Ante meridiem and Post meridiem am or pm
- A Uppercase Ante meridiem and Post meridiem AM or PM
- g 12-hour format of an hour without leading zeros 1 to 12
- G 24-hour format of an hour without leading zeros 0 to 23
- h 12-hour format of an hour with leading zeros 01 to 12
- H 24-hour format of an hour with leading zeros 00 to 23
- i Minutes, with leading zeros 00 to 59
- s Seconds, with leading zeros 00 to 59
- u Milliseconds, with leading zeros 001 to 999
- O Difference to Greenwich time (GMT) in hours and minutes Example: +1030
- P Difference to Greenwich time (GMT) with colon between hours and minutes Example: -08:00
- T Timezone abbreviation of the machine running the code Examples: EST, MDT, PDT ...
- Z Timezone offset in seconds (negative if west of UTC, positive if east) -43200 to 50400
- c ISO 8601 date 2007-04-17T15:19:21+08:00
- U Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) 1193432466 or -2138434463</pre>
- Example usage (note that you must escape format specifiers with '\\' to render them as character literals):
- <pre><code><i>// Sample date:</i>
- <i>// <em>'Wed Jan 10 2007 15:05:01 GMT-0600 (Central Standard Time)'</em></i>
- <b>var</b> dt = <b>new</b> Date(<em>'1/10/2007 03:05:01 PM GMT-0600'</em>);
- document.write(dt.format(<em>'Y-m-d'</em>)); <i>// 2007-01-10</i>
- document.write(dt.format(<em>'F j, Y, g:i a'</em>)); <i>// January 10, 2007, 3:05 pm</i>
- document.write(dt.format(<em>'l, \\t\\he jS of F Y h:i:s A'</em>)); // Wednesday, the 10th of January 2007 03:05:01 PM</code></pre>
- Here are some standard date/time patterns that you might find helpful. They
- are not part of the source of Date.js, but to use them you can simply copy this
- block of code into any script that is included after Date.js and they will also become
- globally available on the Date object. Feel free to add or remove patterns as needed in your code.
- <pre><code>Date.patterns = {
- ISO8601Long:<em>"Y-m-d H:i:s"</em>,
- ISO8601Short:<em>"Y-m-d"</em>,
- ShortDate: <em>"n/j/Y"</em>,
- LongDate: <em>"l, F d, Y"</em>,
- FullDateTime: <em>"l, F d, Y g:i:s A"</em>,
- MonthDay: <em>"F d"</em>,
- ShortTime: <em>"g:i A"</em>,
- LongTime: <em>"g:i:s A"</em>,
- SortableDateTime: <em>"Y-m-d\\TH:i:s"</em>,
- UniversalSortableDateTime: <em>"Y-m-d H:i:sO"</em>,
- YearMonth: <em>"F, Y"</em>
- };</code></pre>
- Example usage:
- <pre><code>var dt = <b>new</b> Date();
- document.write(dt.format(Date.patterns.ShortDate));</code></pre> </div>
-
- <div class="hr"></div>
- <a id="Date-props"></a>
- <h2>Public Properties</h2>
- <table cellspacing="0" class="member-table">
- <tr>
- <th class="sig-header" colspan="2">Property</th>
- <th class="msource-header">Defined By</th>
- </tr>
- <tr class="property-row">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.DAY"></a>
- <b>Date.DAY</b> : String <div class="mdesc">
- <static> Date interval constant </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row alt">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.HOUR"></a>
- <b>Date.HOUR</b> : String <div class="mdesc">
- <static> Date interval constant </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.MILLI"></a>
- <b>Date.MILLI</b> : String <div class="mdesc">
- <static> Date interval constant </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row alt">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.MINUTE"></a>
- <b>Date.MINUTE</b> : String <div class="mdesc">
- <static> Date interval constant </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.MONTH"></a>
- <b>Date.MONTH</b> : String <div class="mdesc">
- <static> Date interval constant </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row alt">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.SECOND"></a>
- <b>Date.SECOND</b> : String <div class="mdesc">
- <static> Date interval constant </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.YEAR"></a>
- <b>Date.YEAR</b> : String <div class="mdesc">
- <static> Date interval constant </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.dayNames"></a>
- <b>Date.dayNames</b> : Array <div class="mdesc">
- <div class="short"><static> An array of textual day names.
- Override these values for international dates, for example...
- Date.dayN...</div>
- <div class="long">
- <static> An array of textual day names.
- Override these values for international dates, for example...
- Date.dayNames = ['SundayInYourLang', 'MondayInYourLang', ...]; </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.monthNames"></a>
- <b>Date.monthNames</b> : Array <div class="mdesc">
- <div class="short"><static> An array of textual month names.
- Override these values for international dates, for example...
- Date.mo...</div>
- <div class="long">
- <static> An array of textual month names.
- Override these values for international dates, for example...
- Date.monthNames = ['JanInYourLang', 'FebInYourLang', ...]; </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="property-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.monthNumbers"></a>
- <b>Date.monthNumbers</b> : Object <div class="mdesc">
- <div class="short"><static> An object hash of zero-based javascript month numbers (with short month names as keys. note: keys are ...</div>
- <div class="long">
- <static> An object hash of zero-based javascript month numbers (with short month names as keys. note: keys are case-sensitive).
- Override these values for international dates, for example...
- Date.monthNumbers = {'ShortJanNameInYourLang':0, 'ShortFebNameInYourLang':1, ...}; </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- </table>
- <a id="Date-methods"></a>
- <h2>Public Methods</h2>
- <table cellspacing="0" class="member-table">
- <tr>
- <th class="sig-header" colspan="2">Method</th>
- <th class="msource-header">Defined By</th>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.getMonthNumber"></a>
- <b>Date.getMonthNumber</b>( <code>String name</code> ) : Number <div class="mdesc">
- <div class="short"><static> Get the zero-based javascript month number for the given short/full month name.
- Override this function...</div>
- <div class="long">
- <static> Get the zero-based javascript month number for the given short/full month name.
- Override this function for international dates. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>name</code> : String<div class="sub-desc">The short/full month name.</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Number</code><div class="sub-desc">The zero-based javascript month number.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.getShortDayName"></a>
- <b>Date.getShortDayName</b>( <code>Number day</code> ) : String <div class="mdesc">
- <div class="short"><static> Get the short day name for the given day number.
- Override this function for international dates.</div>
- <div class="long">
- <static> Get the short day name for the given day number.
- Override this function for international dates. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>day</code> : Number<div class="sub-desc">A zero-based javascript day number.</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>String</code><div class="sub-desc">The short day name.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.getShortMonthName"></a>
- <b>Date.getShortMonthName</b>( <code>Number month</code> ) : String <div class="mdesc">
- <div class="short"><static> Get the short month name for the given month number.
- Override this function for international dates.</div>
- <div class="long">
- <static> Get the short month name for the given month number.
- Override this function for international dates. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>month</code> : Number<div class="sub-desc">A zero-based javascript month number.</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>String</code><div class="sub-desc">The short month name.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-Date.parseDate"></a>
- <b>Date.parseDate</b>( <code>String input</code>, <code>String format</code> ) : Date <div class="mdesc">
- <div class="short"><static> Parses the passed string using the specified format. Note that this function expects dates in normal c...</div>
- <div class="long">
- <static> Parses the passed string using the specified format. Note that this function expects dates in normal calendar
- format, meaning that months are 1-based (1 = January) and not zero-based like in JavaScript dates. Any part of
- the date format that is not specified will default to the current date value for that part. Time parts can also
- be specified, but default to 0. Keep in mind that the input date string must precisely match the specified format
- string or the parse operation will fail.
- Example Usage:
- <pre><code><i>//dt = Fri May 25 2007 (current date)</i>
- <b>var</b> dt = <b>new</b> Date();
- <i>//dt = Thu May 25 2006 (today's month/day <b>in</b> 2006)</i>
- dt = Date.parseDate(<em>"2006"</em>, <em>"Y"</em>);
- <i>//dt = Sun Jan 15 2006 (all date parts specified)</i>
- dt = Date.parseDate(<em>"2006-01-15"</em>, <em>"Y-m-d"</em>);
- <i>//dt = Sun Jan 15 2006 15:20:01 GMT-0600 (CST)</i>
- dt = Date.parseDate(<em>"2006-01-15 3:20:01 PM"</em>, <em>"Y-m-d h:i:s A"</em> );</code></pre> <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>input</code> : String<div class="sub-desc">The unparsed date as a string.</div></li><li><code>format</code> : String<div class="sub-desc">The format the date is in.</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Date</code><div class="sub-desc">The parsed date.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-add"></a>
- <b>add</b>( <code>String interval</code>, <code>Number value</code> ) : Date <div class="mdesc">
- <div class="short">Provides a convenient method of performing basic date arithmetic. This method
- does not modify the Date instance bein...</div>
- <div class="long">
- Provides a convenient method of performing basic date arithmetic. This method
- does not modify the Date instance being called - it creates and returns
- a new Date instance containing the resulting date value.
- Examples:
- <pre><code><i>//Basic usage:</i>
- <b>var</b> dt = <b>new</b> Date(<em>'10/29/2006'</em>).add(Date.DAY, 5);
- document.write(dt); <i>//returns <em>'Fri Oct 06 2006 00:00:00'</em></i>
- <i>//Negative values will subtract correctly:</i>
- <b>var</b> dt2 = <b>new</b> Date(<em>'10/1/2006'</em>).add(Date.DAY, -5);
- document.write(dt2); <i>//returns <em>'Tue Sep 26 2006 00:00:00'</em></i>
- <i>//You can even chain several calls together <b>in</b> one line!</i>
- <b>var</b> dt3 = <b>new</b> Date(<em>'10/1/2006'</em>).add(Date.DAY, 5).add(Date.HOUR, 8).add(Date.MINUTE, -30);
- document.write(dt3); //returns <em>'Fri Oct 06 2006 07:30:00'</em></code></pre> <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>interval</code> : String<div class="sub-desc">A valid date interval enum value.</div></li><li><code>value</code> : Number<div class="sub-desc">The amount to add to the current date.</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Date</code><div class="sub-desc">The new Date instance.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-between"></a>
- <b>between</b>( <code>Date start</code>, <code>Date end</code> ) : Boolean <div class="mdesc">
- <div class="short">Checks if this date falls on or between the given start and end dates.</div>
- <div class="long">
- Checks if this date falls on or between the given start and end dates. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>start</code> : Date<div class="sub-desc">Start date</div></li><li><code>end</code> : Date<div class="sub-desc">End date</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Boolean</code><div class="sub-desc">true if this date falls on or between the given start and end dates.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-clearTime"></a>
- <b>clearTime</b>( <code>Boolean clone</code> ) : Date <div class="mdesc">
- <div class="short">Clears any time information from this date.</div>
- <div class="long">
- Clears any time information from this date. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>clone</code> : Boolean<div class="sub-desc">true to create a clone of this date, clear the time and return it (defaults to false).</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Date</code><div class="sub-desc">this or the clone.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-clone"></a>
- <b>clone</b>() : Date <div class="mdesc">
- <div class="short">Creates and returns a new Date instance with the exact same date value as the called instance.
- Dates are copied and p...</div>
- <div class="long">
- Creates and returns a new Date instance with the exact same date value as the called instance.
- Dates are copied and passed by reference, so if a copied date variable is modified later, the original
- variable will also be changed. When the intention is to create a new variable that will not
- modify the original instance, you should create a clone.
- Example of correctly cloning a date:
- <pre><code><i>//wrong way:</i>
- <b>var</b> orig = <b>new</b> Date(<em>'10/1/2006'</em>);
- <b>var</b> copy = orig;
- copy.setDate(5);
- document.write(orig); <i>//returns <em>'Thu Oct 05 2006'</em>!</i>
- <i>//correct way:</i>
- <b>var</b> orig = <b>new</b> Date(<em>'10/1/2006'</em>);
- <b>var</b> copy = orig.clone();
- copy.setDate(5);
- document.write(orig); //returns <em>'Thu Oct 01 2006'</em></code></pre> <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Date</code><div class="sub-desc">The new Date instance.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-format"></a>
- <b>format</b>( <code>String format</code> ) : String <div class="mdesc">
- <div class="short">Formats a date given the supplied format string.</div>
- <div class="long">
- Formats a date given the supplied format string. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>format</code> : String<div class="sub-desc">The format string.</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>String</code><div class="sub-desc">The formatted date.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getDayOfYear"></a>
- <b>getDayOfYear</b>() : Number <div class="mdesc">
- <div class="short">Get the numeric day number of the year, adjusted for leap year.</div>
- <div class="long">
- Get the numeric day number of the year, adjusted for leap year. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Number</code><div class="sub-desc">0 to 364 (365 in leap years).</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getDaysInMonth"></a>
- <b>getDaysInMonth</b>() : Number <div class="mdesc">
- <div class="short">Get the number of days in the current month, adjusted for leap year.</div>
- <div class="long">
- Get the number of days in the current month, adjusted for leap year. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Number</code><div class="sub-desc">The number of days in the month.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getElapsed"></a>
- <b>getElapsed</b>( <span class="optional" title="Optional">[<code>Date date</code>]</span> ) : Number <div class="mdesc">
- <div class="short">Returns the number of milliseconds between this date and date</div>
- <div class="long">
- Returns the number of milliseconds between this date and date <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>date</code> : Date<div class="sub-desc">(optional) Defaults to now</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Number</code><div class="sub-desc">The diff in milliseconds</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getFirstDateOfMonth"></a>
- <b>getFirstDateOfMonth</b>() : Date <div class="mdesc">
- <div class="short">Get the date of the first day of the month in which this date resides.</div>
- <div class="long">
- Get the date of the first day of the month in which this date resides. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Date</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getFirstDayOfMonth"></a>
- <b>getFirstDayOfMonth</b>() : Number <div class="mdesc">
- <div class="short">Get the first day of the current month, adjusted for leap year. The returned value
- is the numeric day index within t...</div>
- <div class="long">
- Get the first day of the current month, adjusted for leap year. The returned value
- is the numeric day index within the week (0-6) which can be used in conjunction with
- the <a ext:cls="Date" ext:member="monthNames" href="output/Date.html#monthNames">monthNames</a> array to retrieve the textual day name.
- Example:
- <pre><code>var dt = <b>new</b> Date(<em>'1/10/2007'</em>);
- document.write(Date.dayNames[dt.getFirstDayOfMonth()]); //output: <em>'Monday'</em></code></pre> <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Number</code><div class="sub-desc">The day number (0-6).</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getGMTOffset"></a>
- <b>getGMTOffset</b>( <code>Boolean colon</code> ) : String <div class="mdesc">
- <div class="short">Get the offset from GMT of the current date (equivalent to the format specifier 'O').</div>
- <div class="long">
- Get the offset from GMT of the current date (equivalent to the format specifier 'O'). <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li><code>colon</code> : Boolean<div class="sub-desc">true to separate the hours and minutes with a colon (defaults to false).</div></li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>String</code><div class="sub-desc">The 4-character offset string prefixed with + or - (e.g. '-0600').</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getLastDateOfMonth"></a>
- <b>getLastDateOfMonth</b>() : Date <div class="mdesc">
- <div class="short">Get the date of the last day of the month in which this date resides.</div>
- <div class="long">
- Get the date of the last day of the month in which this date resides. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Date</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getLastDayOfMonth"></a>
- <b>getLastDayOfMonth</b>() : Number <div class="mdesc">
- <div class="short">Get the last day of the current month, adjusted for leap year. The returned value
- is the numeric day index within th...</div>
- <div class="long">
- Get the last day of the current month, adjusted for leap year. The returned value
- is the numeric day index within the week (0-6) which can be used in conjunction with
- the <a ext:cls="Date" ext:member="monthNames" href="output/Date.html#monthNames">monthNames</a> array to retrieve the textual day name.
- Example:
- <pre><code>var dt = <b>new</b> Date(<em>'1/10/2007'</em>);
- document.write(Date.dayNames[dt.getLastDayOfMonth()]); //output: <em>'Wednesday'</em></code></pre> <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Number</code><div class="sub-desc">The day number (0-6).</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getSuffix"></a>
- <b>getSuffix</b>() : String <div class="mdesc">
- <div class="short">Get the English ordinal suffix of the current day (equivalent to the format specifier 'S').</div>
- <div class="long">
- Get the English ordinal suffix of the current day (equivalent to the format specifier 'S'). <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>String</code><div class="sub-desc">'st, 'nd', 'rd' or 'th'.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getTimezone"></a>
- <b>getTimezone</b>() : String <div class="mdesc">
- <div class="short">Get the timezone abbreviation of the current date (equivalent to the format specifier 'T').
- Note: The date string ret...</div>
- <div class="long">
- Get the timezone abbreviation of the current date (equivalent to the format specifier 'T').
- Note: The date string returned by the javascript Date object's toString() method varies
- between browsers (e.g. FF vs IE) and system region settings (e.g. IE in Asia vs IE in America).
- For a given date string e.g. "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)",
- getTimezone() first tries to get the timezone abbreviation from between a pair of parentheses
- (which may or may not be present), failing which it proceeds to get the timezone abbreviation
- from the GMT offset portion of the date string. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>String</code><div class="sub-desc">The abbreviated timezone name (e.g. 'CST', 'PDT', 'EDT', 'MPST' ...).</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-getWeekOfYear"></a>
- <b>getWeekOfYear</b>() : Number <div class="mdesc">
- <div class="short">Get the numeric ISO-8601 week number of the year.
- (equivalent to the format specifier 'W', but without a leading zero).</div>
- <div class="long">
- Get the numeric ISO-8601 week number of the year.
- (equivalent to the format specifier 'W', but without a leading zero). <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Number</code><div class="sub-desc">1 to 53</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Date-isLeapYear"></a>
- <b>isLeapYear</b>() : Boolean <div class="mdesc">
- <div class="short">Whether or not the current date is in a leap year.</div>
- <div class="long">
- Whether or not the current date is in a leap year. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <ul><li>None.</li> </ul>
- <strong>Returns:</strong>
- <ul>
- <li><code>Boolean</code><div class="sub-desc">True if the current date is in a leap year, else false.</div></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">Date</td>
- </tr>
- </table>
- <a id="Date-events"></a>
- <h2>Public Events</h2>
- <div class="no-members">This class has no public events.</div>
- </div>
|