# tablesorter

## Assorted date parsers

### Flexible client-side table sorting

Back to documentation

NOTE!

- Parse Dates with these parsers
  - The "Date" column is using the sugar library to parse dates. Make sure to include the sugar library and the sugar-date-parser.
  - The "Weekday" column uses the included "weekday" parser. You can modify parser to match whatever language you are using.
  - The "Month" column uses the included "month" parser. You can also modify the month names within the parser to match whatever language you are using.
  - The "Year" column is just using the included two digit year parser:
    - Formats for "mmddyy", "ddmmyy" and "yymmdd" are available
    - Within the parser code is a `range` variable which is set to `50` years range, which sets the date be within +/- range of the listed two digit year.
    - So if the current year is `2020`, and the listed two digit year is `80` (`2080 - 2020 > 50`), it becomes `1980`.
    - If the listed two digit year is `50` (`2050 - 2020 < 50`), then it becomes `2050`. I hope that makes it clearer.
    - Try out the two digit year calculator below the table.
  - The "Time" column is using the built-in time parser which has been always been included with tablesorter .

# Demo

Date | Weekday | Month | MM/DD/YY | Time
--- | --- | --- | --- | ---
next friday | Friday | Aug | 1/1/12 | 12:00 PM
today | Thurs | September | 1/1/12 | 00:00
last Tuesday | Fri | Mar | 1/1/10 | 18:00
the day after tomorrow | Wed | July | 1/1/13 | 13:00
2010-05-25T12:30:40.299+01:00 | Monday | Jan | 1/1/11 | 1:30 PM
May 25th of next year | Tues | Nov | 1/1/11 | 14:00
25 May 2010 | Tuesday | November | 1/1/11 | 1:58 PM
the last day of March | Mon | December | 1/1/12 | 2:10 PM
last month | Wednesday | April | 1/1/14 | 13:50
one day before yesterday | Thursday | Feb | 1/1/08 | 4:00 AM

### Two digit year calculator:

two digit year becomes 2020
( range "current year" )

# Page Header

    <!-- blue theme stylesheet with additional css styles added in v2.0.17 -->
    <link rel="stylesheet" href="../css/theme.blue.css">
    <!-- tablesorter plugin -->
    <script src="../js/jquery.tablesorter.js"></script>

    <!-- load month, weekday and two digit year parsers -->
    <script src="../js/parsers/parser-date-month.js"></script>
    <script src="../js/parsers/parser-date-weekday.js"></script>
    <script src="../js/parsers/parser-date-two-digit-year.js"></script>

    <!-- http://sugarjs.com/dates#comparing_dates -->
    <script src="../js/sugar.js"></script>
    <script src="../js/parsers/parser-date-sugar.js"></script>

# Javascript

# HTML

Next up: Applying the filter widget ››