jQuery Format - Simplified dates and numbers
JavaScript CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
GPL-LICENSE Initial commit. Oct 5, 2009
README.md Version and info updates Sep 28, 2013
build.properties Version bump. Feb 25, 2012


jQuery Format

The jQuery Format plugin enables the formatting and parsing of dates and numbers. It's a client-side alternative of the popular SimpleDateFormat and NumberFormat APIs.


Formatting dates and numbers is as easy as the following:

$.format.date(new Date(), 'MMMM dd, yyyy KK:mm:ss:SSS a');
$.format.number(7456.2, '#,##0.00#');

Parsing is very similar to the formatting but works with strings as a first parameter:

$.format.date('1.5.2009', 'dd.MM.yyyy');

The second format parameter is always optional and by default the plugin uses the formats of the en_US locale. The locale can be globally configured using the following:

    date: {
        format: 'dddd, MMMM dd, yyyy h:mm:ss tt',
        monthsFull: ['January','February','March','April','May','June','July','August','September','October','November','December'],
        monthsShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
        daysFull: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
        daysShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
        timeFormat: 'h:mm tt',
        shortDateFormat: 'M/d/yyyy',
        longDateFormat: 'dddd, MMMM dd, yyyy'
    number: {
        format: '#,##0.0#',
        groupingSeparator: ',',
        decimalSeparator: '.'


09/28/2013 - jQuery Format 1.3

  • Issue 14: Incorrectly rounding up at 3 decimals
  • Issue 9: Function 'date' should not use current time
  • Various minor fixes

11/24/2011 - jQuery Format 1.2

  • Issue 8: Parsing string
  • Issue 5: Decimal rounding
  • Fixed issue with fraction formatting

09/26/2010 - jQuery Format 1.1

  • Issue 3: Issue on rounding
  • Issue 2: A semicolon is missing line 275
  • Issue 1: Issue with number format #.## (or more)

12/23/2009 - jQuery Format 1.0

Initial release