-<!DOCTYPE html><html><head><meta charset="utf-8"><link href="http://fonts.googleapis.com/css?family=Oswald" rel="stylesheet"><link rel="stylesheet" href="../css/style.css?_=111130_171754"><title>Moment.js Documentation</title></head><body><div id="navwrap"><div id="nav"><h1>Moment.js</h1><ul><li><a href="/" class="btn clean-gray">Home</a></li><li><a href="/docs/" class="btn clean-gray">Documentation</a></li><li><a href="/test/" class="btn clean-gray">Unit Tests</a></li><li><a href="https://github.com/timrwood/moment" class="btn clean-gray">Github</a></li></ul></div></div><div id="content"><div id="docnav"><h2><a href="#/get-it"><span>Get it</span></a></h2><ul><li><a href="#/get-it/github">Github</a></li><li><a href="#/get-it/npm">npm</a></li></ul><h2><a href="#/use-it"><span>Use it</span></a></h2><ul><li><a href="#/use-it/node">In NodeJS</a></li><li><a href="#/use-it/browser">In the browser</a></li></ul><h2><a href="#/parsing"><span>Parsing</span></a></h2><ul><li><a href="#/parsing/date">Javascript Date Object</a></li><li><a href="#/parsing/unix">Unix Timestamp</a></li><li><a href="#/parsing/string">String</a></li><li><a href="#/parsing/string+format">String + Format</a></li><li><a href="#/parsing/string+formats">String + Formats</a></li><li><a href="#/parsing/now">Now</a></li><li><a href="#/parsing/array">Javascript Array</a></li></ul><h2><a href="#/manipulation"><span>Manipulation</span></a></h2><ul><li><a href="#/manipulation/add">Add</a></li><li><a href="#/manipulation/subtract">Subtract</a></li><li><a href="#/manipulation/seconds">Seconds</a></li><li><a href="#/manipulation/minutes">Minutes</a></li><li><a href="#/manipulation/hours">Hours</a></li><li><a href="#/manipulation/date">Date</a></li><li><a href="#/manipulation/month">Month</a></li><li><a href="#/manipulation/year">Year</a></li></ul><h2><a href="#/display"><span>Display</span></a></h2><ul><li><a href="#/display/format">Formatted date</a></li><li><a href="#/display/from">Time from another moment</a></li><li><a href="#/display/fromNow">Time from now</a></li><li><a href="#/display/diff">Difference</a></li><li><a href="#/display/native">Native Date</a></li><li><a href="#/display/valueOf">Value</a></li><li><a href="#/display/seconds">Seconds</a></li><li><a href="#/display/minutes">Minutes</a></li><li><a href="#/display/hours">Hours</a></li><li><a href="#/display/date">Date</a></li><li><a href="#/display/day">Day</a></li><li><a href="#/display/month">Month</a></li><li><a href="#/display/year">Year</a></li><li><a href="#/display/leapyear">Leap Year</a></li></ul><h2><a href="#/i18n"><span>I18N</span></a></h2><ul><li><a href="#/i18n/lang">Changing languages</a></li><li><a href="#/i18n/node">Loading languages in NodeJS</a></li><li><a href="#/i18n/browser">Loading languages in the browser</a></li><li><a href="#/i18n/add">Adding your language to Moment.js</a></li></ul><h2><a href="#/custom"><span>I18N</span></a></h2><ul><li><a href="#/custom/months">Month Names</a></li><li><a href="#/custom/monthsShort">Month Abbreviations</a></li><li><a href="#/custom/weekdays">Weekday Names</a></li><li><a href="#/custom/weekdaysShort">Weekday Abbreviations</a></li><li><a href="#/custom/longDateFormats">Long Date Formats</a></li><li><a href="#/custom/relativeTime">Relative Time</a></li><li><a href="#/custom/meridiem">AM/PM</a></li><li><a href="#/custom/ordinal">Ordinal</a></li></ul></div><div id="docs"><h1>Moment.js Documentation</h1><p>A lightweight javascript date library for parsing, manipulating, and formatting dates.</p><a name="/get-it"></a><h2><span>Where to get it</span></h2><a name="/get-it/github"></a><h3><span>Github</span></h3><a href="https://raw.github.com/timrwood/moment/1.1.2/moment.min.js" class="btn cupid-green"><strong>Production </strong><span class="version">Version 1.1.2</span><span class="filesize">2.8kb minified & gzipped</span></a><a href="https://raw.github.com/timrwood/moment/1.1.2/moment.js" class="btn minimal"><strong>Development </strong><span class="version">Version 1.1.2</span><span class="filesize">20.1kb full source + comments</span></a><p>You can also clone the project with Git by running:</p><pre>git clone git://github.com/timrwood/moment</pre><a name="/get-it/npm"></a><h3><span>npm</span></h3><pre>npm install moment</pre><a name="/use-it"></a><h2><span>Where to use it</span></h2><p>Moment was designed to work in both the browser and in NodeJS. All code will work in both environments. All unit tests are run in both environments.</p><a name="/use-it/node"></a><h3><span>In NodeJS</span></h3><pre>var moment = require('moment');
+<!DOCTYPE html><html><head><meta charset="utf-8"><link href="http://fonts.googleapis.com/css?family=Oswald" rel="stylesheet"><link rel="stylesheet" href="../css/style.css?_=111201_103656"><title>Moment.js Documentation</title></head><body><div id="navwrap"><div id="nav"><h1>Moment.js</h1><ul><li><a href="/" class="btn clean-gray">Home</a></li><li><a href="/docs/" class="btn clean-gray">Documentation</a></li><li><a href="/test/" class="btn clean-gray">Unit Tests</a></li><li><a href="https://github.com/timrwood/moment" class="btn clean-gray">Github</a></li></ul></div></div><div id="content"><div id="docnav"><h2><a href="#/get-it"><span>Get it</span></a></h2><ul><li><a href="#/get-it/github">Github</a></li><li><a href="#/get-it/npm">npm</a></li></ul><h2><a href="#/use-it"><span>Use it</span></a></h2><ul><li><a href="#/use-it/node">In NodeJS</a></li><li><a href="#/use-it/browser">In the browser</a></li></ul><h2><a href="#/parsing"><span>Parsing</span></a></h2><ul><li><a href="#/parsing/date">Javascript Date Object</a></li><li><a href="#/parsing/unix">Unix Timestamp</a></li><li><a href="#/parsing/string">String</a></li><li><a href="#/parsing/string+format">String + Format</a></li><li><a href="#/parsing/string+formats">String + Formats</a></li><li><a href="#/parsing/now">Now</a></li><li><a href="#/parsing/array">Javascript Array</a></li></ul><h2><a href="#/manipulation"><span>Manipulation</span></a></h2><ul><li><a href="#/manipulation/add">Add</a></li><li><a href="#/manipulation/subtract">Subtract</a></li><li><a href="#/manipulation/seconds">Seconds</a></li><li><a href="#/manipulation/minutes">Minutes</a></li><li><a href="#/manipulation/hours">Hours</a></li><li><a href="#/manipulation/date">Date</a></li><li><a href="#/manipulation/month">Month</a></li><li><a href="#/manipulation/year">Year</a></li></ul><h2><a href="#/display"><span>Display</span></a></h2><ul><li><a href="#/display/format">Formatted date</a></li><li><a href="#/display/from">Time from another moment</a></li><li><a href="#/display/fromNow">Time from now</a></li><li><a href="#/display/diff">Difference</a></li><li><a href="#/display/native">Native Date</a></li><li><a href="#/display/valueOf">Value</a></li><li><a href="#/display/seconds">Seconds</a></li><li><a href="#/display/minutes">Minutes</a></li><li><a href="#/display/hours">Hours</a></li><li><a href="#/display/date">Date</a></li><li><a href="#/display/day">Day</a></li><li><a href="#/display/month">Month</a></li><li><a href="#/display/year">Year</a></li><li><a href="#/display/leapyear">Leap Year</a></li></ul><h2><a href="#/i18n"><span>I18N</span></a></h2><ul><li><a href="#/i18n/lang">Changing languages</a></li><li><a href="#/i18n/node">Loading languages in NodeJS</a></li><li><a href="#/i18n/browser">Loading languages in the browser</a></li><li><a href="#/i18n/add">Adding your language to Moment.js</a></li></ul><h2><a href="#/custom"><span>I18N</span></a></h2><ul><li><a href="#/custom/months">Month Names</a></li><li><a href="#/custom/monthsShort">Month Abbreviations</a></li><li><a href="#/custom/weekdays">Weekday Names</a></li><li><a href="#/custom/weekdaysShort">Weekday Abbreviations</a></li><li><a href="#/custom/longDateFormats">Long Date Formats</a></li><li><a href="#/custom/relativeTime">Relative Time</a></li><li><a href="#/custom/meridiem">AM/PM</a></li><li><a href="#/custom/ordinal">Ordinal</a></li></ul></div><div id="docs"><h1>Moment.js Documentation</h1><p>A lightweight javascript date library for parsing, manipulating, and formatting dates.</p><a name="/get-it"></a><h2><span>Where to get it</span></h2><a name="/get-it/github"></a><h3><span>Github</span></h3><a href="https://raw.github.com/timrwood/moment/1.1.2/moment.min.js" class="btn cupid-green"><strong>Production </strong><span class="version">Version 1.1.2</span><span class="filesize">2.8kb minified & gzipped</span></a><a href="https://raw.github.com/timrwood/moment/1.1.2/moment.js" class="btn minimal"><strong>Development </strong><span class="version">Version 1.1.2</span><span class="filesize">20.1kb full source + comments</span></a><p>You can also clone the project with Git by running:</p><pre>git clone git://github.com/timrwood/moment</pre><a name="/get-it/npm"></a><h3><span>npm</span></h3><pre>npm install moment</pre><a name="/use-it"></a><h2><span>Where to use it</span></h2><p>Moment was designed to work in both the browser and in NodeJS. All code will work in both environments. All unit tests are run in both environments.</p><a name="/use-it/node"></a><h3><span>In NodeJS</span></h3><pre>var moment = require('moment');
moment().add('hours', 1).fromNow(); // "1 hour ago"
</pre><a name="/use-it/browser"></a><h3><span>In the browser</span></h3><pre><script src="moment.min.js"></script>
moment().add('hours', 1).fromNow(); // "1 hour ago"
</p><pre>var day = moment("Dec 25, 1995");</pre><p>Browser support for this is somewhat inconsistent. If you are not getting consistent results, you can try using String + Format.</p><a name="/parsing/string+format"></a><h3><span>String + Format</span></h3><p>An input string and a format string</p><pre>var day = moment("12-25-1995", "MM-DD-YYYY");</pre><p>The format parsing tokens are similar to the tokens for <code>moment.fn.format</code>.
</p><p>The parser ignores non-alphanumeric characters, so both <code>moment("12-25-1995", "MM-DD-YYYY")</code>and
<code>moment("12\25\1995", "MM-DD-YYYY")</code>will return the same thing.
-</p><table><tbody><tr><th>Input</th><th>Output</th></tr><tr><td>M or MM</td><td>Month</td></tr><tr><td>D or DD</td><td>Day of month</td></tr><tr><td>DDD or DDDD</td><td>Day of year</td></tr><tr><td>YY</td><td>2 digit year (if greater than 70, will return 1900's, else 2000's)</td></tr><tr><td>YYYY</td><td>4 digit year</td></tr><tr><td>a or A</td><td>AM/PM</td></tr><tr><td>H, HH, h, or hh</td><td>24 hour (for 12 hour time, use in conjunction with a or A)</td></tr><tr><td>m or mm</td><td>Minutes</td></tr><tr><td>s or ss</td><td>Seconds</td></tr></tbody></table><p><strong>Important:</strong>Parsing a string with a format is by far the slowest method of creating a date.
+</p><table><tbody><tr><th>Input</th><th>Output</th></tr><tr><td>M or MM</td><td>Month</td></tr><tr><td>D or DD</td><td>Day of month</td></tr><tr><td>DDD or DDDD</td><td>Day of year</td></tr><tr><td>YY</td><td>2 digit year (if greater than 70, will return 1900's, else 2000's)</td></tr><tr><td>YYYY</td><td>4 digit year</td></tr><tr><td>a or A</td><td>AM/PM</td></tr><tr><td>H, HH, h, or hh</td><td>24 hour (for 12 hour time, use in conjunction with a or A)</td></tr><tr><td>m or mm</td><td>Minutes</td></tr><tr><td>s or ss</td><td>Seconds</td></tr><tr><td>Z or ZZ</td><td>Timezone offset as <code>+0700</code> or
+<code>+07:30</code></td></tr></tbody></table><p>Unless you specify a timezone offset, parsing a string will create a date in the current timezone.</p><p>A workaround to parse a string in UTC is to append <code>"+0000"</code> to the end of your input string, and add
+<code>"ZZ"</code>to the end of your format string.
+</p><p><strong>Important:</strong>Parsing a string with a format is by far the slowest method of creating a date.
If you have the ability to change the input, it is much faster (~15x) to use Unix timestamps.
-</p><a name="/parsing/string+formats"></a><h3><span>String + Formats</span></h3><p>An input string and an array of format strings.</p><p>This is the same as String + Format, only it will try to match the input to multiple formats.</p><pre>var day = moment("12-25-1995", ["MM-DD-YYYY", "YYYY-MM-DD"]);</pre><p>This approach is fundamentally problematic in cases like the following.</p><pre>var day = moment("05-06-1995", ["MM-DD-YYYY", "DD-MM-YYYY"]); // June 5th or May 6th?</pre><p><strong>Important:</strong>THIS IS SLOW. This should only be used as a last line of defense.
-</p><a name="/parsing/now"></a><h3><span>Now</span></h3><p>To get the current time, just call <code>moment()</code>with no parameters.
+</p><a name="/parsing/string+formats"></a><h3><span>String + Formats</span></h3><p>An input string and an array of format strings.</p><p>This is the same as String + Format, only it will try to match the input to multiple formats.</p><pre>var day = moment("12-25-1995", ["MM-DD-YYYY", "YYYY-MM-DD"]);</pre><p>This approach is fundamentally problematic in cases like the following, where there is a difference in big, medium, or little endian date formats.</p><pre>var day = moment("05-06-1995", ["MM-DD-YYYY", "DD-MM-YYYY"]); // June 5th or May 6th?</pre><p><strong>Important:</strong>THIS IS SLOW. This should only be used as a last line of defense.
+</p><a name="/parsing/now"></a><h3><span>Now</span></h3><p>To get the current date and time, just call <code>moment()</code>with no parameters.
</p><pre>var now = moment();</pre><p>This is essentially the same as calling <code>moment(new Date())</code>.
-</p><a name="/parsing/array"></a><h3><span>Javascript Array</span></h3><p>An array mirroring the parameters passed into <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC">Date.UTC()</a></p><pre>[year, month = 0, date = 1, hours = 0, minutes = 0, seconds = 0, milliseconds = 0] var day = moment([2010, 1, 14, 15, 25, 50, 125]); // February 14th, 3:25:50.125 PM
+</p><a name="/parsing/array"></a><h3><span>Javascript Array</span></h3><p>An array mirroring the parameters passed into <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date">new Date()</a></p><pre>[year, month = 0, date = 1, hours = 0, minutes = 0, seconds = 0, milliseconds = 0]
+var day = moment([2010, 1, 14, 15, 25, 50, 125]); // February 14th, 3:25:50.125 PM
</pre><p>Any value past the year is optional, and will default to the lowest possible number.</p><pre>var day = moment([2010]); // January 1st
var day = moment([2010, 6]); // July 1st
var day = moment([2010, 6, 10]); // July 10th
+</pre><p>Construction with an array will create a date in the current timezone. To create a date from an array at UTC, you can use the following.</p><pre>var array = [2010, 1, 14, 15, 25, 50, 125];var day = moment(Date.UTC.apply({}, array));
</pre><a name="/manipulation"></a><h2><span>Manipulation</span></h2><p>Once you have a Moment.js wrapper object, you may want to manipulate it in some way. There are a number of <code>moment.fn</code>methods to help with this.
</p><p>All manipulation methods are chainable, so you can do crazy things like this.</p><pre>moment().add('days', 7).subtract('months', 1).year(2009).hours(0).minutes(0).seconds(0);</pre><a name="/manipulation/add"></a><h3><span>Adding Time</span></h3><p>This is a pretty robust function for adding time to an existing date. To add time, pass the key of what time you want to add, and the amount you want to add.
</p><pre>moment().add('days', 7);</pre><p>There are some shorthand keys as well if you're into that whole brevity thing.</p><pre>moment().add('d', 7);</pre><table><tbody><tr><th>Key</th><th>Shorthand</th></tr><tr><td>years</td><td>y</td></tr><tr><td>months</td><td>M</td></tr><tr><td>weeks</td><td>w</td></tr><tr><td>days</td><td>d</td></tr><tr><td>hours</td><td>h</td></tr><tr><td>minutes</td><td>m</td></tr><tr><td>seconds</td><td>s</td></tr><tr><td>milliseconds</td><td>ms</td></tr></tbody></table><p>If you want to add multiple different keys at the same time, you can pass them in as an object literal.</p><pre>moment().add('days', 7).add('months', 1); // with chaining
</p><pre>var date = new Date(2010, 1, 14, 15, 25, 50, 125);
moment(date).format("dddd, MMMM Do YYYY, h:mm:ss a"); // "Sunday, February 14th 2010, 3:25:50 pm"
moment(date).format("ddd, hA"); // "Sun, 3PM"
-</pre><table><tbody><tr><th>Token</th><th>Output</th></tr><tr><td><b>Month</b></td><td></td></tr><tr><td>M</td><td>1 2 ... 11 12</td></tr><tr><td>Mo</td><td>1st 2nd ... 11th 12th</td></tr><tr><td>MM</td><td>01 02 ... 11 12</td></tr><tr><td>MMM</td><td>Jan Feb ... Nov Dec</td></tr><tr><td>MMMM</td><td>January February ... November December</td></tr><tr><td><b>Day of Month</b></td><td></td></tr><tr><td>D</td><td>1 2 ... 30 30</td></tr><tr><td>Do</td><td>1st 2nd ... 30th 31st</td></tr><tr><td>DD</td><td>01 02 ... 30 31</td></tr><tr><td><b>Day of Year</b></td><td></td></tr><tr><td>DDD</td><td>1 2 ... 364 365</td></tr><tr><td>DDDo</td><td>1st 2nd ... 364th 365th</td></tr><tr><td>DDDD</td><td>001 002 ... 364 365</td></tr><tr><td><b>Day of Week</b></td><td></td></tr><tr><td>d</td><td>0 1 ... 5 6</td></tr><tr><td>do</td><td>0th 1st ... 5th 6th</td></tr><tr><td>ddd</td><td>Sun Mon ... Fri Sat</td></tr><tr><td>dddd</td><td>Sunday Monday ... Friday Saturday</td></tr><tr><td><b>Week of Year</b></td><td></td></tr><tr><td>w</td><td>1 2 ... 52 53</td></tr><tr><td>wo</td><td>1st 2nd ... 52nd 53rd</td></tr><tr><td>ww</td><td>01 02 ... 52 53</td></tr><tr><td><b>Year</b></td><td></td></tr><tr><td>YY</td><td>70 71 ... 29 30</td></tr><tr><td>YYYY</td><td>1970 1971 ... 2029 2030</td></tr><tr><td><b>AM/PM</b></td><td></td></tr><tr><td>A</td><td>AM PM</td></tr><tr><td>a</td><td>am pm</td></tr><tr><td><b>Hour</b></td><td></td></tr><tr><td>H</td><td>0 1 ... 22 23</td></tr><tr><td>HH</td><td>00 01 ... 22 23</td></tr><tr><td>h</td><td>1 2 ... 11 12</td></tr><tr><td>hh</td><td>01 02 ... 11 12</td></tr><tr><td><b>Minute</b></td><td></td></tr><tr><td>m</td><td>0 1 ... 58 59</td></tr><tr><td>mm</td><td>00 01 ... 58 59</td></tr><tr><td><b>Second</b></td><td></td></tr><tr><td>s</td><td>0 1 ... 58 59</td></tr><tr><td>ss</td><td>00 01 ... 58 59</td></tr><tr><td><b>Timezone</b></td><td></td></tr><tr><td>z</td><td>EST CST ... MST PST</td></tr><tr><td><b>Localized date format</b></td><td></td></tr><tr><td>L</td><td>07/10/1986</td></tr><tr><td>LL</td><td>July 10 1986</td></tr><tr><td>LLL</td><td>July 10 1986 8:30 PM</td></tr><tr><td>LLLL</td><td>Saturday, July 10 1986 8:30 PM</td></tr></tbody></table><a name="/display/from"></a><h3><span>Time from another moment</span></h3><p>Another common way of displaying time, sometimes called timeago, is handled by <code>moment.fn.from</code>.
+</pre><table><tbody><tr><th>Token</th><th>Output</th></tr><tr><td><b>Month</b></td><td></td></tr><tr><td>M</td><td>1 2 ... 11 12</td></tr><tr><td>Mo</td><td>1st 2nd ... 11th 12th</td></tr><tr><td>MM</td><td>01 02 ... 11 12</td></tr><tr><td>MMM</td><td>Jan Feb ... Nov Dec</td></tr><tr><td>MMMM</td><td>January February ... November December</td></tr><tr><td><b>Day of Month</b></td><td></td></tr><tr><td>D</td><td>1 2 ... 30 30</td></tr><tr><td>Do</td><td>1st 2nd ... 30th 31st</td></tr><tr><td>DD</td><td>01 02 ... 30 31</td></tr><tr><td><b>Day of Year</b></td><td></td></tr><tr><td>DDD</td><td>1 2 ... 364 365</td></tr><tr><td>DDDo</td><td>1st 2nd ... 364th 365th</td></tr><tr><td>DDDD</td><td>001 002 ... 364 365</td></tr><tr><td><b>Day of Week</b></td><td></td></tr><tr><td>d</td><td>0 1 ... 5 6</td></tr><tr><td>do</td><td>0th 1st ... 5th 6th</td></tr><tr><td>ddd</td><td>Sun Mon ... Fri Sat</td></tr><tr><td>dddd</td><td>Sunday Monday ... Friday Saturday</td></tr><tr><td><b>Week of Year</b></td><td></td></tr><tr><td>w</td><td>1 2 ... 52 53</td></tr><tr><td>wo</td><td>1st 2nd ... 52nd 53rd</td></tr><tr><td>ww</td><td>01 02 ... 52 53</td></tr><tr><td><b>Year</b></td><td></td></tr><tr><td>YY</td><td>70 71 ... 29 30</td></tr><tr><td>YYYY</td><td>1970 1971 ... 2029 2030</td></tr><tr><td><b>AM/PM</b></td><td></td></tr><tr><td>A</td><td>AM PM</td></tr><tr><td>a</td><td>am pm</td></tr><tr><td><b>Hour</b></td><td></td></tr><tr><td>H</td><td>0 1 ... 22 23</td></tr><tr><td>HH</td><td>00 01 ... 22 23</td></tr><tr><td>h</td><td>1 2 ... 11 12</td></tr><tr><td>hh</td><td>01 02 ... 11 12</td></tr><tr><td><b>Minute</b></td><td></td></tr><tr><td>m</td><td>0 1 ... 58 59</td></tr><tr><td>mm</td><td>00 01 ... 58 59</td></tr><tr><td><b>Second</b></td><td></td></tr><tr><td>s</td><td>0 1 ... 58 59</td></tr><tr><td>ss</td><td>00 01 ... 58 59</td></tr><tr><td><b>Timezone</b></td><td></td></tr><tr><td>z or zz (lowercase)</td><td>EST CST ... MST PST</td></tr><tr><td>Z</td><td>-07:00 -06:00 ... +06:00 +07:00</td></tr><tr><td>ZZ</td><td>-0700 -0600 ... +0600 +0700</td></tr><tr><td><b>Localized date format</b></td><td></td></tr><tr><td>L</td><td>07/10/1986</td></tr><tr><td>LL</td><td>July 10 1986</td></tr><tr><td>LLL</td><td>July 10 1986 8:30 PM</td></tr><tr><td>LLLL</td><td>Saturday, July 10 1986 8:30 PM</td></tr></tbody></table><p>While these date formats are very similar to LDML date formats, there are a few minor differences regarding day of month, day of year, and day of week.</p><p>For a breakdown of a few different date formatting tokens, see <a href="https://docs.google.com/spreadsheet/ccc?key=0AtgZluze7WMJdDBOLUZfSFIzenIwOHNjaWZoeGFqbWc&hl=en_US#gid=0">this chart of date formatting tokens.</a></p><a name="/display/from"></a><h3><span>Time from another moment</span></h3><p>Another common way of displaying time, sometimes called timeago, is handled by <code>moment.fn.from</code>.
</p><pre>var a = moment([2007, 0, 29]);
var b = moment([2007, 0, 28]);
a.from(b) // "a day ago"
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
};
-</pre><p>For more information on ordinal numbers, see <a href="http://en.wikipedia.org/wiki/Ordinal_number_%28linguistics%29">wikipedia</a></p><div class="footer"></div></div></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script><script src="../js/docs.min.js?_=111130_171754"></script><script>window._gaq = [['_setAccount','UA-10641787-5'],['_trackPageview'],['_trackPageLoadTime']];
+</pre><p>For more information on ordinal numbers, see <a href="http://en.wikipedia.org/wiki/Ordinal_number_%28linguistics%29">wikipedia</a></p><div class="footer"></div></div></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script><script src="../js/docs.min.js?_=111201_103656"></script><script>window._gaq = [['_setAccount','UA-10641787-5'],['_trackPageview'],['_trackPageLoadTime']];
(function(d, c) {
var ga = d.createElement(c); ga.async = true;
ga.src = "http://www.google-analytics.com/ga.js";
-<!DOCTYPE html><html><head><meta charset="utf-8"><link href="http://fonts.googleapis.com/css?family=Oswald" rel="stylesheet"><link rel="stylesheet" href="css/style.css?_=111130_171754"><title>Moment.js - A lightweight javascript date library</title></head><body><div id="navwrap"><div id="nav"><h1>Moment.js</h1><ul><li><a href="/" class="btn clean-gray">Home</a></li><li><a href="/docs/" class="btn clean-gray">Documentation</a></li><li><a href="/test/" class="btn clean-gray">Unit Tests</a></li><li><a href="https://github.com/timrwood/moment" class="btn clean-gray">Github</a></li></ul></div></div><div id="content"><div id="home"><h2>Moment.js</h2><h3>A lightweight javascript date library for parsing, manipulating, and formatting dates.</h3><div class="col1"><h4><span>Get it</span></h4><pre>npm install moment</pre><a href="https://raw.github.com/timrwood/moment/1.1.2/moment.min.js" class="btn cupid-green"><strong>Production </strong><span class="version">Version 1.1.2</span><span class="filesize">2.8kb minified & gzipped</span></a><a href="https://raw.github.com/timrwood/moment/1.1.2/moment.js" class="btn minimal"><strong>Development </strong><span class="version">Version 1.1.2</span><span class="filesize">20.1kb full source + comments</span></a></div><div class="col2"><h4><span>Use it</span></h4><pre class="js">var now = moment();
+<!DOCTYPE html><html><head><meta charset="utf-8"><link href="http://fonts.googleapis.com/css?family=Oswald" rel="stylesheet"><link rel="stylesheet" href="css/style.css?_=111201_103656"><title>Moment.js - A lightweight javascript date library</title></head><body><div id="navwrap"><div id="nav"><h1>Moment.js</h1><ul><li><a href="/" class="btn clean-gray">Home</a></li><li><a href="/docs/" class="btn clean-gray">Documentation</a></li><li><a href="/test/" class="btn clean-gray">Unit Tests</a></li><li><a href="https://github.com/timrwood/moment" class="btn clean-gray">Github</a></li></ul></div></div><div id="content"><div id="home"><h2>Moment.js</h2><h3>A lightweight javascript date library for parsing, manipulating, and formatting dates.</h3><div class="col1"><h4><span>Get it</span></h4><pre>npm install moment</pre><a href="https://raw.github.com/timrwood/moment/1.1.2/moment.min.js" class="btn cupid-green"><strong>Production </strong><span class="version">Version 1.1.2</span><span class="filesize">2.8kb minified & gzipped</span></a><a href="https://raw.github.com/timrwood/moment/1.1.2/moment.js" class="btn minimal"><strong>Development </strong><span class="version">Version 1.1.2</span><span class="filesize">20.1kb full source + comments</span></a></div><div class="col2"><h4><span>Use it</span></h4><pre class="js">var now = moment();
console.log(now.format('dddd, MMMM Do YYYY, h:mm:ss a'));
</pre><h5><span id="js-format-now"></span></h5><pre class="js">var halloween = moment([2011, 9, 31]); \\ October 31st
console.log(halloween.fromNow());
</pre><h5><span id="js-add"></span></h5><pre class="js">var now = moment();
moment.lang('fr');
console.log(now.format('LLLL'));
-</pre><h5><span id="js-lang"></span></h5></div></div></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script><script src="js/home.min.js?_=111130_171754"></script><script>window._gaq = [['_setAccount','UA-10641787-5'],['_trackPageview'],['_trackPageLoadTime']];
+</pre><h5><span id="js-lang"></span></h5></div></div></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script><script src="js/home.min.js?_=111201_103656"></script><script>window._gaq = [['_setAccount','UA-10641787-5'],['_trackPageview'],['_trackPageLoadTime']];
(function(d, c) {
var ga = d.createElement(c); ga.async = true;
ga.src = "http://www.google-analytics.com/ga.js";